Monday, March 17, 2008

I have just installed wordpress on my computer. Actually, the whole job involes apache setting, mysql installation, and php setting.
Some of the problems I've solved might be helpful for you too, so I write them down.

1.How to set a directory to match specific URL in apache?
The apache has a default DocumentRoot directory, which resides inside your installation directory, while you probably has your wordpress in another place and you don't want to copy it into your apache directory. In this case, you will want to set your wordpress dir to match some specific URL, such as http://localhost/wordpress. To do this, you need alias, which maps web paths into filesystem paths, used to access content that does not live under the DocumentRoot.
A simple example looks like this:
Alias /wordpress D:/programmer_stuff/open-src/wordpress/wordpress
<Directory D:/programmer_stuff/open-src/wordpress/wordpress>
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
DirectoryIndex index.php
</Directory>

2.MySQL problem
I've installed mysql before without any problems. But this time it shows some trouble.
I can't install the service using the mysql's configure wizard. It took me some time to figure out that mysql need to have a main service to use a global administrator. So even though I can add new service instance, I still can't get it work properly. My solution is to manually install a service using sc command. and run the config wizard again, this time it works. It seems that the mysql will show some werid behavior when user didn't follow the assumed steps.

3. php setting
Even after I've all above works down, I still can't use my wordpress. The wordpress constantly tells me that mysql module was not installed. I check the php code, and find the message comes from here:
if ( !extension_loaded('mysql') && !file_exists(ABSPATH . 'wp-content/db.php') )
die( 'Your PHP installation appears to be missing the MySQL which is required for WordPress.' );

This problem will ocur if I've not uncomment the sql extension in php.ini. What's worse, I didn't even install mysql extension, and I can't see a ext folder in my php directory. It's simple to solve it after you know everything, but may be really hard when you are a newer.
So the solution on my machine is to reinstall my php and add extension=php_mysql.dll, note you have to add php_ as prefix, which is the real name.


The final step is to make my modification work, I need to have the php.ini reloaded. But how to do that? Since I am using apache2.2, so just write a bat: httpd -k restart, remember to install your apache as a service, otherwise the command won't work.
After all of the above are correctly done, Wordpress get to work, so enjoy it now.

No comments: