Developing on Windows, publishing on Linux

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bobthebuilder
Forum Commoner
Posts: 32
Joined: Tue Mar 22, 2011 5:06 pm

Developing on Windows, publishing on Linux

Post by bobthebuilder »

hello, I have done all my php development on my Windows PC but am considering using a linux VPS on which to host my website. Will this cause any problems? I am using standard php with the GD and pkzip libraries, and I also use standard file IO commands like mkdir & unlink etc. I am nervous that code developed on my PC won't work on the server and this will make debugging a nightmare. Thanks
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: Developing on Windows, publishing on Linux

Post by oscardog »

As long as you're using a standard PHP release, and the same PHP version is on the server you're going to host it on, you should be fine. What were you using to host it on your Windows PC? XAMPP?
bobthebuilder
Forum Commoner
Posts: 32
Joined: Tue Mar 22, 2011 5:06 pm

Re: Developing on Windows, publishing on Linux

Post by bobthebuilder »

Thanks for the reassurance. On my development PC I have WAMP.
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: Developing on Windows, publishing on Linux

Post by oscardog »

bobthebuilder wrote:Thanks for the reassurance. On my development PC I have WAMP.
Ah the other option. I see no reason, assuming PHP/MySQL versions are the same on both systems, why there would be a problem.

I never quite got why people used such tools when there are millions of free hosting websites out there that will give you a free subdomain and an area to test, all for free! Plus shared hosting can be found for $1-2 now :)
jarofgreen
Forum Commoner
Posts: 71
Joined: Sun Jul 11, 2010 12:40 pm

Re: Developing on Windows, publishing on Linux

Post by jarofgreen »

Actually, there is one major gotcha. Windows has a case insensitive file system, Linux doesn't. So:

Code: Select all

require "Code.php"  // file is actually code.php
Will work on Windows and not on Linux.

I haven't found a way to catch these errors on Windows, but the good news is they are really easy to debug.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Developing on Windows, publishing on Linux

Post by califdon »

Although I'm not doing especially sophisticated development, I too have been using a Windows development environment and Linux production servers for years with no problems (other than the case-sensitivity of filenames, as jarofgreen mentioned).
bobthebuilder
Forum Commoner
Posts: 32
Joined: Tue Mar 22, 2011 5:06 pm

Re: Developing on Windows, publishing on Linux

Post by bobthebuilder »

Thanks. And as predicted by you chaps, I have indeed had case-sensitive type issues! Quite easy to fix though.

The other issue I have met is dealing with directory persmissions. The scripts dynamically make directories outside of root in which to store customer data and I have had some chmod issues. Still need to get a good handle on that, as setting

Code: Select all

chmod($dirname, 0777);
is probably really stupid, but that's what I have done for the moment.
Post Reply