tags:

views:

971

answers:

9

After becoming somewhat estranged open source, and spending some years developing web applications in ASP.Net, I'm going to start doing quite a lot of PHP / MySQL development.

I've quite painlessly installed WampServer to get a development environment up and running on my Windows machine, but the platform I'll be targeting will most likely be Linux. So my question is, am I likely to run into problems due to developing on Windows while targeting Linux? Is it advisable to invest in getting a Linux environment setup in which to develop my LAMP apps?

+9  A: 

I've been doing it for the last couple of years and haven't run into any problems yet - if anything it gives you an advantage by forcing you to write more portable code.

Greg
Yes. Please develop on WAMP and deploy on LAMP, we do just the opposite, and while it was painful transitioning we're much better off because of it. I can hot swap environments on production for testing whenever I need to without worrying about the underlying platform.
cfeduke
Just be careful with the file permissions and remember that windows is case insensitive while Linux isn't. being unaware of that could cause some nasty bugs.
levhita
+1  A: 

No, developing on wamp and running on lamp should be fine, but at least stage on lamp. I've gone both ways without many problems (ok, there used to be a bunch of problems deploying enterprise sites on WAMP (don't try to use the PHP ISAPI filter) but they are solvable now (fastcgi)). As long as you aren't adding any PECL modules that state they aren't supported on Windows, you shouldn't have any problems. Also (since you are stating you are using WAMP I assume you are using MySql), mssql and PHP have a bunch of issues (the ancient driver it requires seriously limits the length of your query).

Kris Erickson
+1  A: 

In theory, PHP and MySQL should be completely platform-independent.

In practice, if you're going to have a real production application, I suggest you to have a testing environment mirroring the production one, to avoid surprises.

friol
+1  A: 

Yes I would recommend developing on an environment as close to your production environment as possible. There are differences between how PHP works on Windows as compared to Linux. And other differences like how Linux handles file permissions as compared to Windows. I run the free VMWare server with a Linux virtual machine. I have a Samba share on the Linux VM that I mount as a networked drive in Windows. Then I use Eclipse on Windows as my code editor.

ejunker
A: 

No, because pretty much the only thing you can't do on WAMP if you target LAMP is using System()/Exec Calls, and usually that is a good thing because those should be used very sparsely.

Michael Stum
+2  A: 

Permissions and the fact that on Windows filenames aren't case-sensitive are the two things I can think of that have been a pain to me. But they are

  1. Solvable, at worst with an ftp client to change permissions.
  2. Good, easy ways to make you a better programmer (in a small way, yes).
Adriano Varoli Piazza
A: 

It's worth having a LAMP sandbox so you can get to know where to find - and how to edit - config files, get comfortable with restarting services, handling scheduled jobs etc. if you are going to have to deal with these tasks in production.

Colonel Sponsz
+6  A: 

If you can I'd invest in some kind of linux, or at least *nix, development environment. For simple applications and website your setup is fine, but you will eventually run into subtle differences when you deploy.

Here are some things off the top of my head you'll want to watch out for if you stick with your Windows environment.

  1. File paths. A lot of PHP functions take file paths as arguments. Do NOT use the windows backslash () separator. Even though you're on windows PHP will let you use a forward slash separator. Ideally abstract this away with your own file path class.

  2. Apache Modules, PECL Extensions. Apache Windows and Apache Unix often come with a different set of Apace Modules installed by default. Also, the same version of a module may run differently on a different platform. If your application relies on any apache module, make sure it's available for both platforms. Same goes for PHP custom extensions (PECL)

  3. Process Forking. Using exec, `, etc. in a web app is a bad idea to begin with, but if you're using these functions they're going to behave differently between windows and *nix

  4. File Writing, Locking, etc. works different

  5. Email is handled differently on both platforms

  6. The PHP group's code word for Windows is "some platforms". You can research more on your own if you'd like

In general, the closer your development environment matches your production environment, the less environment/deployment related issues you'll have.

Hope that helps!

Alan Storm
For nearly all the issues you mentioned there are portable workarounds.
Marcos Lara
A: 

No.
VirtualBox + Shared folders should be useful if you have about 6-8 hours free on one weekend to get all VBox basics clear and settings worked out. If you're switching to Linux, the process may take upto a month and you will be highly unproductive in that time, in terms of production code.
It is a good idea to keep practicing Linux on VBox for Windows, in advance before switching, using one of [PCLinuxOS, CentOS, OpenSuse, Ubuntu]. I prefer CentOS, PCLinuxOS. There's a gem called SLAMPP and another beauty called XAMPP <-- works on Linux and Windows.
IMO, as a rough guesstimate, if you expect to code 2000-3000 lines of code (that you write/add) per project, for 6mo-1yr, stick to Windows and master Linux meanwhile using VBox.
If above that, or if you plan to make a cool new LAMP website, I think you should switch to Linux first. Take a month more to get used to Linux. You can still shuffle around with dual boot or VBox for as long as you like, starting as early as you can - learning Linux enough to debug a LAMP app does take time.