Tutorial :Cross platform PHP caveats?


I've been given an existing PHP application that was originally deployed on a LAMP host.
Because most of our team are .Net developers, our boss wants it deployed in a windows environment.

Is it madness to expect this to just work?

Here's some additional info of the LAMP host:

  • Linux 2.4.32
  • PHP 5.2.6
  • No non-default modules


In my experience, it can be done and works fine. The most important things I'd keep in mind are:

  1. Use Apache on Windows, don't use IIS (even if it's possible)
  2. Make sure you use unix style slashes for directories. Those work on both platforms.
  3. Be very careful with case sensitivity. Since Windows is not case sensitive (though it is case preserving), if you include a file and spell it with the wrong case, it will work on Windows and fail on Linux.


Heck even just migrating from one hosted server to a different one usually requires SOME tweaking and adjustments. I don't imagine having to do it in a Windows environment would be much different. I was invloved in the migration of a large PHP app just last week and we (3 people) were able to get things going in about half a day.


It depends what's being done in the application. Two areas to look into though are where the app looks for files in the file system (using Linux specific paths?) and finding windows builds of any php modules (from PECL in particular).


Be very careful that at no point is exec called. A lot of extremely lazy code is written that will use this, and for obvious reasons it may not port well.


Some what i've experienced over the years:

  • Too old/new DB driver for PHP
  • Path problems
  • Change from 32 bit to 64 bit system or vice versa affects PHP internal integer handling (bit calculations returns weird results suddenly)
  • Locale and localization issues
  • Missing functions (manual have usually notes that it won't work or behaves differentially in windows)
  • File name casing

And always check and double check that Apache modules and PHP modules are atleast the same version as in old system.

It's also not too bad to run GNU/Linux virtualized on top of Windows with for example VMWare if code doesn't seem to like running in Windows.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »