Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
PHP Programming

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?
This discussion has been archived. No new comments can be posted.

Adopting PHP Code to a UNIX/Windows Environment?

Comments Filter:
  • by Anonymous Coward
    Most PHP code will run under both Windows an UNIX (LAMP, usually) without any problems. There are a few things you should keep in mind:

    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.
  • by joq ( 63625 ) on Saturday June 16, 2001 @03:09PM (#146591) Homepage Journal

    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)
  • Despite the recent departure of Tim Perdue you would do well to ask on phpbuilder.net's forums. Lots of users there, many clueless, but there are about a dozen people who really know what they're talking about.
  • by grammar nazi ( 197303 ) on Saturday June 16, 2001 @10:51PM (#146593) Journal
    For further information, I suggest Web Application Development with PHP 4.0 (Ratschiller and Gerken)

    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.

  • 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 use IIS on Win2k and Apache on SunOS 5.6 and write in PHP accessing a MySQL database. As far as I can tell, PHP doesn't have any problems moving back and fourth between the two. someone mentioned phpbuilder, good site to look at, PHP.net has very good online docs too. other sites to keep in mind: zend.com and hotscripts.com there are good ASP -> PHP tools out there. good luck convinceing them to move to PHP, i know lots of ASP people who won't touch PHP.

Marriage is the triumph of imagination over intelligence. Second marriage is the triumph of hope over experience.

Working...