
** UPDATE ** An updated version of this process has been posted here.
DreamHost has been my hosting company of choice for a good few years now. What's not to love about these guys? Awesome pricing, employee owned, carbon neutral and the best damned panel out there. Their service can be rocky from time to time, but in the end they always come through and I wind up completely happy again. They also do free registered non-profit hosting which I think is great.
One thing I've found is that getting Concrete5 to work on DreamHost with Pretty URL's seems to be somewhat of a moving target. In the past I've offered guides via the Concrete5 forums on how to accomplish this. Once again confronted with re-figuring out the process, I thought I'd post about my most recent successful experience.
Upon installing Concrete5 5.3.3.1 on DreamHost and enabling Pretty URL's, you'll likely be confronted with a "No input file specified" error when navigating anywhere beyond the home page.
For security reasons, DreamHost chooses to run PHP scripts as a CGI. When mixed with mod_rewrite, the desired URL is not properly passed on to php5.cgi resulting in a full breakdown when Concrete5 attempts to decipher which page is requested.
The solution is, oddly enough, to run PHP through a rapper with a completely non-modified copy of their own php.ini.
First make a cgi-bin directory within your site's root directory:
mkdir cgi-bin
chmod 755 cgi-bin
Now copy DreamHost's php.ini file into this directory:
cd cgi-bin
cp /etc/php5/cgi/php.ini .
chmod 644 php.ini
Next we must create the PHP wrapper itself in the cgi-bin directory:
touch php-wrapper.fcgi
chmod 744 php-wrapper.fcgi
Use your favorite editor to put the following contents in php-wrapper.fcgi:
#!/bin/sh
export PHP_FCGI_CHILDREN=2
exec /dh/cgi-system/php5.cgi $*
Lastly, the contents of your .htaccess file should look something like:
Options +ExecCGI
AddHandler php5-cgi .php
Action php5-fastcgi /cgi-bin/php-wrapper.fcgi
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/cgi-bin/.*
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Most notably are the first 3 directives which enable the wrapper, and the RewriteCond directive immediately following RewriteEngine On that instructs mod_rewrite to ignore requests against the cgi-bin.
Ensure that nobody but the owner can write to your .htaccess file (or it won't work) and then you'll be golden!
I can't promise that this will work on every DreamHost server. They are all in various stages of PHP and Apache versions. This particular server was running PHP 5.2.9.
Please add a comment
back to regular.
Leave a Reply