Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is PHP for Windows the same as Linux, Mac, etc.?

Tags:

php

If I write PHP (php5 if it matters) on Windows and Apache is the same as writing PHP on another OS and Apache? I do not mean things like file paths. Thank you.

like image 674
johnny Avatar asked Jul 21 '09 01:07

johnny


1 Answers

Mostly, but you have a few things to watch out:

  • Under *nix systems path names are case-sensitive, not under Windows.
  • Under *nix systems, the path separator is /. Under Windows it is \, but PHP translates / automatically. Either use the DIRECTORY_SEPARATOR constant or always use /.
  • Under *nix systems, the path traversal schema is different. There is no such thing as a drive letter. There are mount points instead.
  • Under *nix systems, file permissions are more strict than on Windows by default.
  • Some functions are not available under Windows or behave differently. These are mostly for low-level functions (memory status, system status). Refer to the PHP documentation.
  • If you are using exec() or any other similar function, the commands won't be the same. Refer to your system documentation.

About Apache:

You might hit some snags at some point in one server uses PHP as a module and the other one uses it via fcgi. Two Apache configured the same way will behave the same way.

like image 83
Andrew Moore Avatar answered Sep 18 '22 13:09

Andrew Moore