PHP hosting

For development, does it matter what the PHP OS is running on? In other words, would it be nice to develop a PHP application on Windows and deploy to Unix (or vice versa)?

In other words, are PHP applications running the same on Windows and Unix?

+3
php
source share
8 answers

Almost, but not quite. There are a few things you should keep an eye on.

1) . File Names: Windows is a case-insensitive operating system. If you create a Foo.php file, you can include it with include('Foo.php') OR include('Foo.php') . When you move your project to Linux / Unix, it will break if you do not have the right case.

2) There are some language differences in the platform, usually when it comes to what depends on the integrated functionality of the OS. They rarely appear, but you may encounter them from time to time. For example, the checkdnsrr () function did not exist in Windows PHP prior to version 5.3.0.

I also had another, but I think I need coffee, my brain just stopped.

Edit: Oh yes, I remember:

3) . The PHP packages you get for Linux / Unix can be very widely used in what they include in the default installation compared to Windows. You need to make sure that you are testing your application in the development window on the opposite platform, to be sure that you have all the necessary libraries compiled / added, or you will get some good fatal errors from a regular regular application.

+5
source share

The main PHP language works the same way, but with any language you will run into OS problems if you develop one platform and deploy it on another. There are differences in the paths (file location), web server settings (which keys are available in the super _ $ _SERVER), which extensions are available if they use OS functionality (some PHP extensions are platform specific).

However, these problems are quite specific. They can be frustrating, but you will solve each of them once, and then move on. In practice, most web developers end up using a development machine that is different in configuration from their production servers, and learning how to deal with these issues is useful and leads to a more portable application.

+2
source share

There are some differences between PHP in Windows and Linux, as the ability to execute processes.

For the most part, they are the same, but there are certain functions that either do not work on Windows or behave somewhat differently. In each case, you will need to link to the PHP manual pages to find out what. Linux is truly a native OS for PHP. The differences are minimal.

+1
source share

You should keep an eye on platform features such as fork (Unix only).

http://us3.php.net/pcntl_fork

0
source share

One more thing, you did not mention it in your post, but I'm going to find the original WAMP stack here ...

Note that in MySQL, identifiers are case-insensitive on Windows, but case-sensitive on Linux.

0
source share

As stated above, there are some features that do not exist on Windows, but on Unix.

One thing that I would be wary of when I first start using permissions: Windows usually allows a PHP script to read / write anything, while a Unix installation will not (especially since the actual web server can work as perfectly different user than the user who owns the script).

0
source share

There are quite a few differences with the IO file between linux and windows (outside of case sensitivity). The usual thing that most people get is most Windows (DOS) files ending the line with \ r \ n, unix ends with \ n and macs end with \ r. Simple enough to code around.

0
source share

I run Drupal (several versions with a wide range of expansion modules) on windows / xampplite all the time and deploy it in a unix box. never noticed a single difference.

And I also run SugarCRM, Joomla, Pligg, Zend Framework, CMS Simple, WordPress, Mantis, PhPBB and others that I can’t remember right now.

-one
source share

All Articles