This entry describes the challenges I faced when I tried to install WordPress on a Windows 2003 webserver. The WordPress website has a page about installing WordPress in 5 minutes. Well, I know now that this is impossible. Especially, if you're trying to install it on a machine without PHP already installed and configured with MySQL.
I started out with a webserver which had MySQL v5.x running. This server was configured correctly, since I used MySQL for ages. This post doesn't describe the MySQL installation. If you download the latest Windows installer, it shouldn't be that hard to install (Setup.exe -> Next -> Next -> etc. -> Finish).
I started out with "installing" PHP v5.1.6 for Windows. Somehow I was hoping to get a nice installer, but all I got were some files in a zip container :(. Anyway, I extracted those files to "c:\PHP" on my webserver. All I needed to do now is to configure PHP by editting "PHP.ini" (I hate those long ini files :x). As a starting reference I used the recommended INI file in the PHP directory. Scrolling through the file (which is thouroughly documented inline) I changed the things that I needed. Since it was the recommended ini file I didn't bother much on all the possible features. I just wanted to get Wordpress to work.
The following text is the result of a couple of hours trying, searching the Internet, and cursing that the (online)manuals failed in every single way.
Step 1: Extract the PHP files to "c:\PHP". Editting the PHP.ini file is not necessary for PHP to work initially under IIS. This will be discussed later on.
Step 2: Get PHP enable under IIS.
I created a (standard) website under IIS which I called "Wordpress". After that I needed to enable PHP for that website.
I used the ISAPI filter for PHP instead of the CGI processor.
Open the properties of the "Wordpress" website, and open the ISAPI filter tab
Press the "Add" button
Call the filter name "PHP", and locaten the PHP ISAPI-filter (in my case "c:\PHP\php5isapi.dll"). When finished press "OK", and press "OK" again in the earlier screen.
Now I needed to tell IIS what to do when it encounters .php files. This is done under the "Home Directory" tab.
Set the execution permissions to "Scripts only", after that, press the "Configuration" button.
Here I added the PHP extension by clicking the "Add" button.
The executable is (again) the ISAPI filter, which I configured as an ISAPI filter earlier on. Just click "browse" and locate the php5isapi.dll file in the "c:\PHP" directory.
From this point on all open IIS windows can be closed by pressing "OK". The only thing left is to restart the Webserver.
Resetting IIS can be done by the commandline by entering "iisreset.exe" in a dos-box.
Step 3: Testing PHP
Create a file called "phpinfo.php" in the root of the Wordpress website. The content of this file should be:
< ?php
phpinfo();
phpinfo(INFO_MODULES);
?>
After saving this file, go with your browser to your website and open the phpinfo.php file. I received a nice page displaying various settings etc. from PHP.
Note that the first table displays the location of the PHP.ini file used for the PHP engine. It points by default to the Windows directory. More on this in Step 4.
Now I needed to enable MySQL support for PHP
Step 4: Edit the PHP ini file
IMPORTANT: move the PHP.ini file to the Windows directory, and than start editting it.
Somehow, the PHP engine expects the file over there. When I didn't get it to work initially (you get an error "
Your PHP installation appears to be missing the MySQL which is required for WordPress." when you try to install/configure Wordpress.
Wordpress relies heavy on the MySQL database, so I needed to tell PHP to use the MySQL extensions. Extensions were disabled by default, so I needed to remove the semicolon infront of the extensions line, and point to the location of the "ext" directory within the PHP tree:
extension_dir = "c:/php/ext/"
Note that, eventhough I'm installing on a Windows server, I used forwarded slashes "/", instead of the regular backslash "\". If you use the backslash in the PHP.ini file it won't work!!!!
Now I needed to enable the MySQL extension itself. Around line 630 in the ini file are the supplied Windows extensions. Remove the semicolon from the following lines:
extension=php_mysql.dll
extension=php_mysqli.dll
After this reset the webserver (again) with "iisreset.exe" command from the commandline.
Step 5: Verifying MySQL support
Open the phpinfo.php page again in the browser to verifiy that MySQL is enabled. Some where on the page should be a table called "Mysql". If it's not there, than there's no MySQL integration, and the installation of Wordpress won't work.
From this point on, you can use the famous
5-minutes-installation guide on the Wordpress website.
Step 6: Enable the upload of files though Wordpress
When I tried to upload the images used in this post I gort an error stating that WordPress wasn't able to create the folders and files. It seemed that I needed to add the anonymous account to create/write files. Since I didn't want this on all my directories I added the
IUSR_ account with write and modification right only to the wp-content folder of the WordPress installation.
This might impose some security risks. I will try to find out if there is an other (more secure) way of dealing with this.
Click to read more ...