Moving files from my pc to my server.

Hi,

I started a new thread because I din’t want to hijack
Max’s thread ( about email)

Yesterday Joe wrote:

If you do stuff on your Windows system, you're likely to end up with DOS line endings, which may or may not break things on Linux. So, to be safe, you'd want to also run dos2unix on all of the files after uploading them

This was in response to me saying that I was going to download the
phpMailer from sourceforge to my pc and then unzip the directory and
upload it to the server directory using smartFTP.

Now if what you say is correct, Joe, then surely ALL the stuff that
I (and everyone else) FTP’s to their servers should be tested with this dos2unix thingy ?

I am having a look at the Webmin Download/Upload module but that paragraph above has really confused me !!!

Now if what you say is correct, Joe, then surely ALL the stuff that I (and everyone else) FTP's to their servers should be tested with this dos2unix thingy ?

There are ways to avoid the problem, of course (set your FTP client to binary rather than text mode, for starters). But I’ve seen enough errors to know that people get it wrong a lot. We get problem reports about the install script all the time, for example. We used to get one every couple of days…but since we provided a copy/paste example to copy it straight to the server, that number has declined dramatically, but we still get error reports about it.

It is entirely possible to route everything through your Windows machine without causing any problems. I just think it’s a more complicated way to do things, if the goal is to get a file from a website to your server.

And the “dos2unix thingy” isn’t a test…it just converts DOS line endings to UNIX line endings on any file you send it. If there are no DOS line endings it won’t do anything to the file (though you obviously shouldn’t run it on compiled programs, since they’re binary and might have bit combinations that look like DOS line endings but aren’t). So, you can’t really run it willy-nilly over everything you see on your server. Just things like plain text PHP, Perl, Python, shell, Ruby, etc. scripts.

Oh, yeah, setting your FTP client to binary mode is enough if you never open the files on your Windows machine. But if you open them in a Windows text editor, edit them, and save them, they might get converted to DOS line endings without warning. It depends on the editor and the configuration…but it can happen.

My original point was that if you have no idea about any of this stuff (as seems to be the case), then you’re probably safest simply downloading straight to the server. You’ll eventually get to where you recognize the symptoms (permission denied errors are a common error when you try to run a DOS line ended file on UNIX)…but until then it can be confusing.

Well, its the first time I’ve heard of this :o

In the Swift docs they say:

Extracting the Library

You extract the archive by using your favorite unarchiving tool such as tar or 7-Zip.

You will need to have access to a program that can open uncompress the archive. On Windows computers, 7-Zip will work. On Mac and Linux systems you can use tar on the command line.

To extract your downloaded package:
Use the "extract" facility of your archiving software.

The source code will be placed into a directory with the same name as the archive (e.g. Swift-4.0.0-b1).

You only need to upload the "lib/" directory to your web host for production use. All other files and directories are support files not needed in production.

You will need FTP, rsync or similar software installed in order to upload the "lib/" directory to your web host.

To upload Swift Mailer:

  1. Open your FTP program, or a command line if you prefer rsync/scp.
  2. Upload the "lib/" directory to your hosting account.

The files needed to use Swift Mailer should now be accessible to PHP on your host.

So are they giving bad advice about how to install their php library files ?

they are not saying you need to open the files in some windows program and save it in a bad format…it is common knowledge that windows (files) and linux (files) are not very compatible with eachother

php files btw should be uploaded in binary mode.
you can also install ubuntu on your pc next to windows (dualboot) and ftp through that.

there is more than one way to prevent issues.
Why not just download files directly to your server through wget. It isn’t that difficult and saves you a lot of headaches…

I wouldn’t call it “bad” advice. If all you have is FTP access to the server, and no tool like Webmin’s Upload and Download module, you’d have to go through your PC.

You’re making way too big a deal of this, Davvit. I just mentioned a hard-to-diagnose (but easy to fix) problem that often catches Windows users who route files through their PC on the way to the server by surprise. I see the effects of it about once every week or so…so it is a common problem, and it does catch people by surprise. Does that mean it’s something that deserves a several post thread about it? Probably not.

OK - thanks for explaining it.

I will start using this upload/download feature.

And - yes I do think think that this thread is worthwhile because if
you see problems relating to this every week, then that’s a lot of problems!

In the internet marketing arena there are hundreds of tutorials and courses showing people how to upload files to their servers using FTP clients on their windows pcs - and nowhere ever have I seen this problem mentioned!

Now this maybe because some FTP clients use binary automatically for non-windows servers ( I just checked my smartFTP version and it does ).

Anyway - I hope that this thread will add some extra insight for other uses on this forum as well as helping me.

I really appreciate all the effort you guys are making and I especially appreciate the answers to my questions. I assume that some of my questions and your answers will also be useful to others.

All the best.
Dave

and nowhere ever have I seen this problem mentioned!
That doesn't mean it doesn't exist. Many tutorials I find on the net are poorly written. Often done by bloggers who rip out a page from some documentation in the hope to attract some traffic.

A good ftpclient for windows would be winscp btw.
http://winscp.net/eng/index.php

… and finally.

Many tutorials I find on the net are poorly written.

Yes, I couldn’t agree more!!

Thanks for that link.