WordPress

From DreamHost
Revision as of 10:02, 24 December 2006 by Grimboy (Talk | contribs)

Jump to: navigation, search

WordPress is a PHP-based weblog ("blog") publishing tool.

See also: KB / Account Control Panel / Goodies :: One-Click Installs / WordPress Blog

Installing

Installing WordPress on Dreamhost is really simple: just go to the goodies section on Panel and use the One Click Install.

If you plan to use the same MySQL database for more than one WordPress install before running the Install.php go to the directory where you installed WordPress and edit the wp-config.php:

pico wp-config.php

Go to this line:

$table_prefix = 'wp_'; // example: 'wp_' or 'b2' or 'mylogin_' 

Change the wp_ to something unique like wp_blogname.

This will create a separate section in the database.

Importing

After installing you can go to http://yourdomain.com/wp-admin/import.php to import from other blog software like Blogger, Movable Type, etc.

Blogger

You may get errors when trying to import from Blogger. If you have problems, follow the directions exactly as usual, but add the following in:

Before you go to the import page above, login to blogger. If you currently publish to FTP, change your publishing method to blogspot by choosing a unique blogspot address. Logout of blogger and then go delete any blogger cookies. Then run the import.php above by logging in and going for it.

Customizing

There are many places one may find themes and resources for developing them yourself. Here are just a few:

You can also find plugins at many places as well.

Troubleshooting

Lots of stuff can go wrong with wordpress. Make sure to refer to this section first if anything does for you.

Multiple installs

Just pasting in an IRC convo for now. Feel free to edit it into something better.

<bunnywabbit_> grimboy: I'm trying to solve this problem: http://climbtothestars.org/archives/2006/12/18/hairy-htaccess-dreamhost-wordpress-problem/
<bunnywabbit_> which is literally driving me nuts
<bunnywabbit_> support isn't helping
<bunnywabbit_> I don't know what to do anymore
<bunnywabbit_> so I'm wondering if changing to mod_php might help
<grimboy> bunnywabbit_, Nah, you have to solve these things on your own with dreamhost
<bunnywabbit_> grimboy: exactly
<bunnywabbit_> what I'm trying to do
<grimboy> So what does your .htaccess look like. What type of authorisation are you using?
<Sabrejack> anyhow..  I'm fairly familiar with php (cgi/mod), wordpress, and .htaccess
<bunnywabbit_> AuthUserFile /home/cafe/.htmembres
<bunnywabbit_> AuthType Basic
<bunnywabbit_> AuthName "Authentification obligatoire."
<bunnywabbit_> Require valid-user
<bunnywabbit_> that's int he protected directory
<bunnywabbit_> and the root .htaccess is a wordpress install .htaccess, standard
<Sabrejack> I think it's more likely to be an issue with the .htaccess in the parent directory
<Sabrejack> wordpress by default attempts to hijack all sorts of stuff
<Sabrejack> i'd look for an .htaccess at /home/cafe/yoursite.com/.htaccess 
<bunnywabbit_> jali: where it should be
<bunnywabbit_> have to go eat
<bunnywabbit_> Sabrejack: that one is a normal wp .htaccess
<grimboy> bunnywabbit_, He's right
<grimboy> bunnywabbit_, Add this to the parent one.
<grimboy> RewriteCond %{REQUEST_URI} ^/membres.*$ [OR]
<grimboy> RewriteCond %{REQUEST_URI} ^/failed_auth.html$
<grimboy> RewriteRule ^.*$ - [L]
<bunnywabbit_> grimboy: so I put the 3 last lines you gave in the parent .htaccess?
<grimboy> bunnywabbit_, Yeah, give it a try. Might not work.
<grimboy> bunnywabbit_, Put it at the start
<bunnywabbit_> looks like this now grimboy, does that look ok?
<bunnywabbit_> <IfModule mod_rewrite.c>
<bunnywabbit_> RewriteEngine On
<bunnywabbit_> RewriteBase /
<bunnywabbit_> RewriteCond %{REQUEST_URI} ^/membres.*$ [OR]
<bunnywabbit_> RewriteCond %{REQUEST_URI} ^/failed_auth.html$
<bunnywabbit_> RewriteRule ^.*$ - [L]
<bunnywabbit_> RewriteCond %{REQUEST_FILENAME} !-f
<bunnywabbit_> RewriteCond %{REQUEST_FILENAME} !-d
<bunnywabbit_> RewriteRule . /index.php
<bunnywabbit_> </IfModule>
<grimboy> bunnywabbit_, Yeah, looks ok to me.
<Sabrejack> .htaccess and rewrite rules get processed before any scripts.
<grimboy> Yay, it's worked.
<grimboy> Hurrah. Not a genius though, just a guesser.
<bunnywabbit_> so what do those lines do?
<bunnywabbit_> and what did you guess the problem was?
<grimboy> bunnywabbit_, Stop the parent (public) blog stealing the urls from the private blog.
<grimboy> That's what they do.
<bunnywabbit_> lovely
<grimboy> Yeah, wordpress can be evil like that.

Cache plugin and random breakage

In the below everything --like this-- should be replaced with different stuff.

This plugin breaks when dreamhost moves what fileserver you're on. The problem is /home/--user--/--example.com--/wp-content/advanced-cache.php is a symbolic link to /home/.cluster/--user--/--example.com--/wp-content/plugins/wp-cache/wp-cache-phase1.php. Log via ssh and do this:

<code>
$ cd --example.com--/wp-content
$ rm advanced-cache.php
$ ln -s /home/--user--/--example.com--/wp-content/plugins/wp-cache/wp-cache-phase1.php advanced-cache.php
</code>

Plugins

Certain plugins make use of environment variables that are not present on DreamHost's servers. If you run into weird problems, try adding this to your wp-config.php on the line after the initial "<?php":

$_SERVER['SCRIPT_NAME'] = $_SERVER['SCRIPT_URL'];
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].$_SERVER['SCRIPT_URL'];

You Tube videos

If you would like to add youtube.com videos to your WordPress blog there are a few plugins you can install, but the easiest way might be to do the following:

Disable the visual rich editor by unchecking that box under Users>Your Profile.

Paste the following text into your post, changing the link to the video you want to use:


<embed src="http://www.youtube.com/v/ValVQNo6hPE" type="application/x-shockwave-flash" width="425" height="350"></embed>


Save it and see what happens, it should work. You can always go back and enable the rich editor, but for posting this code, it seems you have to disable it first, otherwise it will not save it properly. Hope it helps someone!

Permalinks

One should be careful when specifying a permalink structure and take into consideration how the Apache HTTP Server and mod_rewrite process requests.

The permalink structure tags require that WordPress be invoked through internal redirection in order to match database records to the values present in the URI. This results in Apache reporting status code 200 "OK" in your server log files. However if WordPress does not find a match, it reports a 404 "Not found" to the web browser.

Also, since URI processing ends when the internal redirection is made, the permalink feature my prohibit one from accessing valid URIs that do not have anything to do with WordPress. Here is an example:

  • Blog address (URI): http://example.com/
  • Structure: /%category%/%postname%

If one were to browse to http://example.com/stats to review the site statistics provided by DreamHost, then WordPress intercepts the request so it can check if 'stats' is a category. It won't find it and report "Not found", and processing of the has URI stopped before the server could access the site statistics (probably via the Alias directive, aka the "Re-map Subdir" feature).

To avoid problems, one should avoid installing WordPress into the root OR use a permalink structure that does not begin with a tag. You can also follow the directions on this page to restore your access to /stats.

Blank Pages

If you have "blank pages" in Wordpress with wp-cache turned on after you upgrage to PHP 5.1.2 - there is simple fix to solve the problem:-

  1. Open <domain>/wp-content/plugins/wp-cache/wp-cache-phase2.php file* in your favourite text editor, where <domain> is the domain that you're having troubles with EG: dreamhost.com/wp-content/plugins/wp-cache/wp-cache-phase2.php
  2. Alternatively if that file is not in that location for some reason you can issue this command to find it from the <domain> directory: find . -name wp-cache-phase2.php
  3. Find out wp_cache_ob_end function
  4. then inside that function find the line with: ob_end_clean(); (it should be line 219 or about)
  5. and finally replace that line with: ob_end_flush();

Enable Referer Error

You may come across this error, it will stop you saving changes in the admin section of Wordpress. It is a security measure to stop people gaining access to the admin panel. The most likely reason for it happening is you have enabled "Remove www." in the domains section of dreamhost panel. If you still wish to have www. disabled you can fix the problem by:-

(Warning: Editing the settings in here could break your blog, only attempt it if you feel confident doing so)

  1. Goto the "goodies" section of the dreamhost panel.
  2. Click MySQL.
  3. Click on phpMyAdmin and log in using your details.
  4. Select the database for Wordpress in the left hand panel then click "wp_options" (or whatever prefix you have called it e.g x_options)
  5. Click Browse at the top.
  6. The top entry here should be site_url.
  7. Edit this by clicking on the small pencil icon on the left hand side. Change the URL from http://www.example.com/blog to http://example.com/blog
  8. Save the changes. That should hopefully have cured the problem.

If not refer to the link provided in the error message.

See Also