Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VPS Plesk error 1

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
I am trying to run perl scripts on a VPS which uses a Plesk interface. Sometimes the scripts run when FTP'd and sometimes not. The ISP tells me that there are unusual line endings on some of my scripts.
I have been FTPing scripts for years with no problems until I started on this VPS.
I know it is a little vague but is the set up of a VPS so much different than shared hosting?
I don't see any kind of setup for FTP in Plesk but I may just be blind, can anyone help?

Keith
 
Most servers I've seen that run Plesk were Windows servers.. and most servers I've seen that are shared are Linux servers. So there might be a difference if they run different operating systems.

The end of line issue looks like a DOS-to-Unix thing (or vice versa). Uploading the files in ASCII mode should automatically convert line endings over when transferring to a DOS/Windows server to a unix-like server and vice versa.

Otherwise try converting the line endings yourself (using dos2unix or unix2dos, if you're using a unix system) and uploading in binary mode and see if that makes a difference.

Kirsle.net | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
The VPS is a linux server or at least the op system is linux. You are quite right, it is a DOS to UNIX problem.
I have done some file level experiments and it appears that chr(10)'s are being converted to chr(10)chr(13) when they are FTP'd over.
The ISP has never come across this problem before and will not be drawn when I enquire if others are using Perl on their VPS systems.
I would have thought there would be some setting in Plesk to automatically set the type of line ending. The is a manual method but that is very time consuming when doing multiple edits.

Keith
 
afaik the conversion is done in the FTP client.

Kirsle.net | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
My FTP client is set to UNIX standard which works for all the other servers I work with.

I have found a solution to the problem, it is a bit messy but it works.
Upload the file in ascii
Download it in binary
upload it in ascii
that sorts the line endings out but drives me crackers.
Thanks for the help on this.

Keith
 
Is there a possibility that the line endings are being converted on the server itself or is there some subtle difference between a VPS and a shared server?


Keith
 
Upload the file in ascii
Download it in binary
upload it in ascii

This seems like it would get you the same result as uploading it in binary in the first place?

If the file has DOS newlines on your side to start with...

Code:
1. Upload the file in ascii
\n becomes \r\n in the file

2. Download it in binary
Downloads the \r\n copy of the file

3. upload it in ascii
\r\n becomes \n in the file

or vice versa.

The biggest difference I've seen between shared hosting versus a VPS, is that with a VPS you can control which software is installed and how the server is configured.

I've had shared hosts in the past with annoying restrictions in place, like with mod_security set up in a way that any URL containing "about" was met with a Forbidden apache error (including "/about.html", which I imagine would be a common URI on a lot of websites)...

And another time I was on a shared host that wouldn't allow e-mail to be sent unless your script authenticated with a user/pass you set up in yer cPanel... which is unreasonable for a lot of apps out there (what forum software for example lets you configure a user/pass for sending mail? most software I've seen just lets you choose between SMTP or /sbin/sendmail... but on this one web host, neither method worked without authentication).

Being a VPS though you should be in control of what software is installed, although things like Plesk might like to take over the whole operating system (I know cPanel behaves like this, it likes the whole server to be run "its way" and modifying anything by hand usually doesn't last very long before it changes things back).

Kirsle.net | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
This seems like it would get you the same result as uploading it in binary in the first place?
I thought that too but if I upload in binary, the script does not run.
The other thing I don't understand is the format of the local file once it has been downloaded in Ascii. I would expect all the line endings to have been removed leaving a continuous one line file but the local file still has the line feeds in it.
I am now certain that the Plesk software is converting chr(10)to chr(10)chr(13).
I am not too impressed with the Plesk software so far. I am a novice when it comes to setting up servers, but software that regularly throws Java errors in it's help files is to me, pretty lame.

Keith
 
Are you certain it's chr(10)chr(13) (i.e. LF+CR) and not the other way around (CR+LF)? I haven't heard of any operating system that uses LF+CR.

Have you tried uploading using scp or sftp, if it is supported?

Annihilannic.
 
Sorry, I may have got the order wrong(CR+LF) sounds more likely.
I am using the same FTP software, same settings in both cases but the extra char is only added on the VPS.
What is scp or sftp?

Keith
 
scp (secure copy) and sftp (secure ftp) work over SSH. If you have SSH access to your VPS you should be able to use scp or sftp.

From a unix system you can scp files to a server like this:

Code:
scp myfile.txt user@remotehost:/where/you/want/it/to/go

The usage is

Code:
scp [user@[host:]]file [user@[host:]]file

It's like cp (copy) except it copies it from host to host over SSH. If copying a file off the local system to a remote one it would be like the format I showed. Try `man scp` for more info.

sftp works the same as FTP. If you happen to be using Linux with the GNOME desktop, Nautilus [gnome file browser] has built-in support for sftp. Just type in the location bar e.g. "sftp://user@hostname/"

There are scp and sftp clients for Windows too but I haven't used them since I run Linux on all my machines.

Kirsle.net | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top