Fun with PHP, MySQL on Windows 2000 Advanced Server
I recently decided that it is about time to replace my old P4 server in the interest of speed, space and power reductions. Even with a P4, this sever is heavily underused. My choice was a mini-ITX form factor system running the Intel Atom N330 Dual Core processor. Although there is little improvement over CPU speed, I also migrated to an OCZ Indilinx SSD. That’s a little background for you. Now, my existing machine is my web/db server and is running Windows 2000 (yes, I realize its a 10yr old OS, but its working just fine for my purposes), SQL Server, MySQL, IIS5 and PHP.
The reason why I am writing this is to help others try to avoid a very small item I missed with my PHP install that caused me hours of delay. From what I have seen in the numerous searches I did out there, others have the same problem, and some may not have even discovered it. The funny part is that it is obvious once you figure it out! Read on for more info and details of the issue…
Before I got the new machine, I wanted to do a test run of the OS and software on my Asus EEE 901 – just for fun! For the most part, I wanted to test the operation of this wordpress site (plastibots.com), PHP and MySQL. The 901 has a dual boot and my second drive (4GB SSD) was the one I chose to put W2K Advanced Server on. So, I went through the routine to install the server OS, get IIS up and running etc. I also went through a fresh install of MySQL. So that all went fine. I decided that since PHP does not really need to be installed – I copied it over to the 901, setup the ISAPI redirector in IIS, and added the path entry C:\PHP to the PATH variable. All is good right? Well, when I ran my test PHP page, it showed that all was fine, I got all the PHP config and info bits, so I thought I was good. (Important Note – I had the php_mysql.dll extenstion enabled in php.ini – but I did not notice MySQL was not showing in the config page. I also recall in the past that the config page would complain about missing extensions with a PHP error instead of the config=ok page).
In order to get my WordPress site db up and running, I installed PHPMyAdmin. This is when the trouble started. When I first tried to run this, I got an error pointing me to php mysql (something along the lines of it not being configured or running). This is when the clock started ticking and I tried to make friends with Google search (as I do many times a day). Most (if not all) the searches I came up with pointed me to all the normal things to check with a PHP install. Which I verified and confirmed. What kept throwing me off is that with all my past PHP installs, I seem to recall the phpinfo test page always failing if extensions could not load. What makes this all worse was that I had a terminal window open all during combing through my current P4 server config to see what I was missing – and I did not notice it.
After many searches and pulling my hair out, it hit me as I was looking at my P4 server environment variables. A variable in the list of System Variables (same location as the PATH var) there it was. A variable called PHPRC that points to the PHP path (c:\PHP in my case). I created this variable on the 901 and BAM! PhpMySQL came alive. When I ran my php test page (phpinfo) I then noticed the MySQL header and details section (something I forgot about in the past and did not take notice of). I think part of my problem was that I was hung up (and convinced) that phpinfo should have been failing if an extension could not load – and I knew that the purpose of the PATH environment variable was so that PHP could find the extension directory. I also just decided to go check the PHP manual installation documentation, and although it mentions the PATH variable, the PHPRC variable was not pointed out that obviously in the steps. So, if you did not know you needed it, you would not know what to look for. (I did find it in the user comment postings further down the page after specifically searching for PHPRC) Because of this, I was focused in finding the solution in other places and in other parts of either PHP, the dll itself (its version) as well as seeing what files where in the /WINNT/System32 folder. I’ll also add that I have NO PHP or MySQL dll files in the /System32 folder (as I have seen many solutions out there that indicate that this is the solution). My system works with all PHP files in the /PHP directory (ditto for MySQL).
Needless to say, I documented this install as I will have to do it all again in a few weeks. I am posting this to help all those out there that may find themselves in a similar bind that I was in.
Rate This Post: