bleeding edge php and windows

I tend to run the latest bleeding edge php 5.1 snaps on my development machine. Probably not the best idea in the world, but I like it that way. I keep up on the php cvs and zend engine cvs commits so whenever some fix or feature goes in that looks good I fire up snaps.php.net and grab an archive. I set up my php install so it's simply a matter of stopping IIS and apache, unzipping the new archive, and starting the servers back up again.

For all that the geek world hates windows, I actually prefer doing development on it. Why? because if works in windows, nine times out of ten it will work in linux without a problem. Windows is usually the place where all the weirdness, workarounds, and bugs happen. Linux tends to "just work".

But this past week they've done something (I have no idea what) that makes my php install suddenly uber-flakey. It may be an xdebug/php incompatibility. I love to use xdebug for debugging when I work, and it's had a problem since. Well I can't remember when, that when you shut down apache xdebug farks something in php and the whole thing crashes. That means no restarts, I have to stop and then start the server all the time, but it's not the end of the world. But now the whole thing is just flakey. I'll visit a page, change a line or two of php, and then refresh the page only to have the whole server go kaboom. So I'll restart and refresh the page again and it's magically fine. Ugh, probably more shutdown trouble. That part of the code seems to be VERY flakey on windows in any condition.

I really wish they'd fix the problem...

Installing php on windows isn't that difficult really. I usually download from snaps.php.net, but getting the non-installer version from php.net works just as well. Then you pick a folder to keep the php installation in. I keep mine in c:/program files/php cause I'm real creative. So unzip/untar the thing. Then put it in your path variable. This is the easiest way to make sure you get the right dlls where they need to be without having to copy mega files around. In xp the path variable is in system properties->advanced->environment variables. Anyway, not sure if I had to restart to get that to work right or not.

So then you just need to set up apache/IIS to use php. I always install them module/isapi. For IIS 5.1, head to the IIS mmc snap-in and get the properties on the website/folder where you want php to run. On the first tab there, hit the configuration button, it's down under application settings. Add a new one - use .php or whatever as the extension and throw in the path to the php5isapi.dll. If you have it somewhere with pathname space (like me) IIS is stupid so you'll have to use short names, so my path to the .dll looks like c:/progra~1/php/php5isapi.dll And since I like to use pathinfo - don't check the "check if script exists" box. Leave everything else at default. Also you'll need to hit the documents tab and add index.php as a default page - I tend to move it up to the number two or three (after index.html/index.htm) but that's just me.

Then restart that bugger and everything should work :) Apache is even easier. Add LoadModule php5_module "c:\program files\php\php5apache2.dll" (or wherever your stuff happens to be), then add AddType application/x-httpd-php .php PHPIniDir "C:\program files\php" or wherever you want your ini to go, DirectoryIndex index index.html index.html.var index.php (or whatever you want to use in any order) - then restart

Since I run both apache and iis, I have IIS sent to a different port and apache has a virtual host that redirects to the IIs server (I defined the name in my hosts file for fun) I also have a php-isapi.ini file in c:\windows ( the only place the darn IIS likes to look) and my php ini can go wherever I want for apache. That way I can do two different setups if I feel like it. the -isapi makes sure that only the isapi will try to read the ini, the apache module just ignores it. A pretty neat trick :)

Well, that's all for today. I'll keep lamenting over my newly flakey installation and hopefully they'll get whatever is wrong squared away quickly.

Comments

Be the first to write a comment!

Post a Reply