Word Press Installation

The following is the procedure I used to install WordPress on Fedora Core 5. It is fairly direct/straight forward and for the most part taken from the WordPress documentatiion. I have however covered on error message condition during installation that caused me considerable pain.
- MySQL, PHP and Apache are installed on your machine where you will be running WordPress
- PHP has been compiled with mysql support. Please note that php as distributed with Fedora Core 5 is NOT compiled with mysql support. My suggestion is to remove the FC5 rpm for PHP, download PHP from www.php.net and recompile with mysql support (see the PHP readme on this blog for how this is done)
- the following “options” will be used for the sake of clarity in this installation procedure (adjust accordingly):
- your download directory is: /downloads/wordpress
- WordPress database: mydb
- WordPress User:Â me
- WordPress database password: doodah
- Apache’s document root directory for word press location: /var/www/html/blog
- your domain name is: www.myplace.org
1. Setting up the WordPress database support in mysql:
- mysql -u root -p
- Â passwd: (your password)
- CREATE DATABASE mydb;
- GRANT ALL PRIVILEGES ON mydb.* TO ‘me’@'localhost’ IDENTIFIED BY ‘doodah’;
2. Installing WordPress
- cd /downloads/wordpress
- gunzip wordpress-2.0.4.tar.gz
- cd wordpress
- cp wp-config-sample.php wp-config.php
- vi wp-config.php make the following changes:
- define(‘DB_NAME’, ‘mydb’); // The name of the database
- define(‘DB_USER’, ‘me’); // Your MySQL username
- define(‘DB_PASSWORD’, ‘doodah’); // …and password
- define(‘DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value
- cd /downloads/wordpress/wordpress
- find . -print | cpio -pdmvu /var/www/html/blog
- in a webbrowser go to this url (your website where you put the wordpress files, i.e., http://www.myplace.org/wp-admin/install (or /var/www/html/blog/wp-admin/install) and follow the instructions on the screen.
- Note the password carefully! It is a random password that was generated just for you. If you lose it, you will have to delete the tables from the database yourself, and re-install WordPress. Once logged in you can change it to a more meaningful password.
Error condition while trying to login: The last page of the “install” procedure as discussed above will present you with a login option to WordPress and so that you may begin designing your blog. But wait!!! What is this “Forbdidden” error I am getting in my browser. After many hours of “Googling” and noting that many before me had this problem, not many of the posts made sense. Some where “chmoding” the entire WordPress filesystem structure. This is not a good idea. Also it did not seem to fix the problem for most. Finally I stumbled on to the problem causing the “Forbidden” Error. It has to do with Apache’s configuration. After all you told Apache what you wanted to do. And it does what you ask. Here is the area causing the problem in Apache’s httpd.conf file.
Lets assume that you are running a webserver (not WordPress) at /var/www/html and that this is yout DocumentRoot entry in your httpd.conf file. What does this mean to Apache? Well it means that your web content will be served from this location on your disk. Also remember that Apache says that it is to serve a file called index.html. Why? because your httpd.conf file contains the attribute: DirectoryIndex index.html index.html.var. So when someone visits your page they are going to the /var/www/hmtl directory and if there is an index.html file there that file will display in their browser. So what is with this Forbidden Error I am getting? The problem has to do with the two items discussed earlier in this paragraph: DocumentRoot and DirectoryIndex. Because you are now running WordPress at the /var/www/html/blog location you need to make additional changes to Apache. At the /var/www/html/blog location is an index.php file not an index.html file. What is Apache going to to with this? Apache says to load index.html files not index.php files so you will get a “Forbidden Error”. It is misleading. What needs to be done to correct this is to use a virtual host directive at the bottom of the httpd.conf file like so:
——–sample code fragment – cut here ————–
NameVirtualHost *:80
#
# virtual host for myplace.org
#
< VirtualHost *:80 >
ServerName www.myplace.org
ServerAlias myplace.org *.myplace.org
DocumentRoot /var/www/html
ServerAdmin webmaster@myplace.org
ErrorLog /var/log/httpd/myplace.error_log
CustomLog /var/log/httpd/myplace.access_log common
< Directory >”/var/www/html”>
DirectoryIndex index.html
options -Indexes FollowSymLinks MultiViews +Includes
AddType text/html .shtml
AddType application/x-httpd-php .php .phtml
AddOutputFilter INCLUDES .shtml
AllowOverride None
Order allow,deny
Allow from All
< /Directory>
#
# This next part tells Apache what to load in your blog directory – the index.php file.
#
< Directory “/var/www/html/blog” >
DirectoryIndex index.php
Options FollowSymlinks
AddType application/x-httpd-php .php .phtml
AllowOverride ALL< /Directory>
< /VirtualHost>
Entering into your browser www.myplace.org will take your browser to /var/www/html and load an index.html page if it finds one. Entering into your browser www.myplace.org/blog will load an index.php file if it finds it there. There will be no more “Forbidden Errors”. Now the drawback to this configuration is that the world wide web must know that you have a /var/www/html/blog directory. They won’t unless you place a link on your /var/www/html/index.html file point to the blog directory. A better way would be to buy a domain name of your choice and then configure a virtual host entry in Apache to point to your blog on disk. By looking at the code fragment above you should be able to replicate it for such use.
Caution: If you currently have a domain name and you are going to piggyback your blog on a directory within its document root be advised that all of you work with WordPress will be relative to that path, i.e. /var/www/html/blog. This means that all of your comments, pages etc. will be stored in MySQL relative to the path in which WordPress operates. If later you decide to buy your own domain name for a blog, you can move the contents of /var/www/html/blog to /var/www/blog (for example) but your pages will not function. Remember that all “httpd://….” references will point to /var/www/html/blog. So, before moving anything dump from MySQL the WordPress database. It will be in the form of a filename.sql. You can edit the file in “vi” and globally change all of your httpd:/var/www/html/blog” references to “httpd:/var/www/blog” references. Delete or rename the WordPress database in MySQL, and reload the modified “.sql” file. Then copy /var/www/html/blog to /var/www/blog/. Everything should be fine. But you know that not everything goes as planned so keep the original “sql” file that was dumped so you can “go back” if necessary.
Hope this is helpful,
Ron
Entries (RSS)
[...] to this guy for giving me the heads up on how to fix it, albeit in [...]
Thanks for taking the time to comment. Always nice to know that your effort did make a difference.
Hey, I tried fixing it this way and it didn’t work. I did similar thing with mediawiki where I just pasted the entire directory of mediawiki and named it to /www/html/wiki, accessed wiki/config/index.php right away. The difference is I did chmod a+w on it. I tried chmod on wordpress as well but it didn’t work. Any other way? Thanks
Hey, never mind. It works now. I just deleted everything and re-extracted the package directly to /www/html/ instead of moving the package to it. Your way made sense to me but don’t why it didn’t work. Thanks anyway…
Happy it worked out.
Cool post the title name Useful Ramblings » Word Press Installation is also pretty ingenious keep up the good work, check out my site too thanks.