Windows Apache MySQL PHP

Redirecting apache command line output on Windows

Posted in Windows Apache MySQL PHP on November 24th, 2008 by Les – Be the first to comment

So, you want to run

httpd.exe -tS

to syntax check your conf file and view all virtual hosts. You need the virtual hosts info in a file but

httpd.exe -tS >file.txt

doesn’t work.

That’s because apache output goes to STDERR not STDOUT. I have used dos/windows for years and never had cause to know or use this but simply doing.

httpd.exe -tS 2>file.txt

Will work as it sends the STDERR output to the file you specify.

Can’t create TCP/IP socket (10106)

Posted in Windows Apache MySQL PHP on November 4th, 2008 by Les – Be the first to comment

This post may help some other Windows/Apache/Mod-fcgid users out.

We recently migrated a windows 2000 Apache install to a Windows Server 2003 box.

Despite having all the mysql libs, the pho_sockets module etc configured php kept failing to connect to a mysql localhost with the error “Can’t create TCP/IP socket (10106)

After much googling and little answers (though many others having the same problem) I realised that in my httpd.conf in the section where we set runtime values for the PHP (such as PHP_RC, TEMP FOLDER etc.) included the path C:\WINNT which of course was fine on windows 200 but on Server 2003 should have been C:\WINDOWS.

Once all these paths were changed and apache started, all was well.

My guess is that php_sockets is dependent upon windows winsock implementation and with duff paths being passed to php-cgi.exe the winsock library could not be loaded and hence all socket stuff failed.

I’m only guessing though. Whatever the reason it’s unimportant since there was a clear problem with the paths.

Hope this saves someone else a couple of hours!