Adopting PHP Code to a UNIX/Windows Environment? 6
Pointy Haired Programmer queries: "I work for a Fortune 100 company that is currently using a mixture of *NIX web servers and MS web servers. This company is very slow to adopt any new technology that isn't MS. So, we are serving most of our pages either through ASP or some type of CGI. Right now, we are investigating the possible use of PHP on our network due its cross platform abilities. I really want to see this happen for us, as I am an avid supporter of both PHP and Apache. I was wondering what the Slashdot Community had to say about the situation and maybe some of the advantages and the disadvantages of PHP being deployed in such a manner." Not having used PHP before, I'm not quite sure how well the code adapts to changes in its environment. Are there any "gotcha's!" that one needs to worry about when taking PHP code from Unix to Windows and vice-versa? How well does PHP work on Microsoft Servers?
it should work (Score:2)
1) exec() or system()-calls
This is obvious, isn't it?
2) webserver-differences
If you use Apache under Unix and IIS under Windows, you may run into trouble when you use stuff that isn't provided by PHP itself but by the webserver. Especially the names of server-vars may differ.
Flush may not work under IIS (I'm not sure about this, might have been some other Windows-webserver). Then again, popen can only be called from an application which is run from a console under Windows, so you'll have to change your IIS configuration if you wanna use it.
3) function availability
Some PHP functions will not work under Windows. But this is very rare and mentioned in the manual.
If you run into problems, the annotated online-manual at php.net is your friend.
4) library availability
If you want to use the full feature-set of PHP, you'll have to use some custom libraries. They may not be available under Windows.
Another problem is thread-safety. Using non-threadsafe libraries like gdlib is not a problem with Apache 1.x unter Unix, but it is with both Apache and IIS under Windows, cause these are both multi-threaded. Only CGI will work here. Before you use a library, make sure you can use it on both platforms.
two cents worth (Score:4)
I wouldn't know the comparisons between PHP over Windows and a Nix based machine, but should you want to switch over quickly check out ASP2PHP [naken.cc] this way you don't have to write tons of code over. I used to use PHP last year on one of my sites [antioffline.com] but moved to a hacked version of ePerl since PHP caused high loads with the scripts I had running.
Now what was scary in my eyes was the fact that the scripts were nothing but random image and random quote scripts, and it brought the load on the server extremely high and if you think that the average 6.75 load is not high for nothing but random quotes, and images then your off your rocker since I've got it down to an average of about 2.something. Anyways I guess it depends on what it is your doing.
mod_python is pretty neat for gui based stuff but again it can be a mem hog in its own right. Only way to get a good enough grasp is to just try it out, it certainly won't kill you lest you change all your production machines without testing. (hey I've seen it done)
Another quick note is, stay a bit weary of reviews of ASP vs. PHP or other since no two systems will be configured to do the same tasks, and your always going to get a biased opinion whether its from an ASP developer or PHP developer. I've had my share of reading articles claiming one is better than the other for X reasons. Best case scenario TIYASOYO. (test it yourself and see on your own)
Better to ask onphpbuilder.net (Score:1)
Re:it should work (Score:3)
It assumes basic knowledge of PHP, and focuses on Web application developmnent. Problems with cross-platform compatibility. Large scale V. small scale projects. Planning, customizing the Zend engine. I've read about 1/2 of it and I think it's a very good book. From what I've read, this book might be exactly what you are looking for.
Not a huge task to learn if you already do ASP (Score:1)
Its a little late to be adding to this, but I recently took it upon myself to learn PHP for some voluntary support of a club site...
I set up PHP running under the MS Personal Web Server, and using MySql, to develop some relatively simple members pages, data forms etc, to be transferred to a site running on a Linux server. I was impressed with the relative ease of installing & configuring it all.
After having used ASP on IIS for quite some time, I found PHP has much in common with ASP in terms of structure & use. You should expect an experienced ASP person to pick up PHP in no time at all (provided they know how to read the manual). I enjoyed learning & applying PHP, just for the change. Just try it, you will like it, once you get the config file sorted out :)
LesF
I work in both IIS and Apache using PHP (Score:1)