on 26/2/09
I'm building a stats app for a professor friend of mine, and
the application needs a bit more resources than the Dreamhost
default setup allows (30 seconds of execution, and 8MB of
posted data). If you're looking for a way to use your own
php.ini file with a CakePHP application you've got
on Dreamhost, here's what ended up working for me. These steps
are a variation of what you can find on the Dreamhost wiki, but
they needed a little love before the .htaccess directives
played nice with Cake's.
In any case, follow the instructions in the wiki - they're a good start.
cgi-bin directory in your domain's
root folder.cp
/etc/php5/php.ini
$HOME/example.com/cgi-bin/php.ini#! /bin/sh export PHPRC=/home/[username]/[domain]/cgi-bin exec /dh/cgi-system/php5.cgi $*
chmod 755 $HOME/example.com/cgi-bin chmod 755 $HOME/example.com/cgi-bin/php-wrapper.cgi chmod 640 $HOME/example.com/cgi-bin/php.ini
Here's where we divert from the canon and get it done with CakePHP. Rather than using the provided .htaccess changes, I modified the root .htaccess file like follows.
<IfModule mod_actions.c>
Options +ExecCGI
AddHandler php5-cgi .php
Action php-cgi /cgi-bin/php-wrapper.cgi
Action php5-cgi /cgi-bin/php-wrapper.cgi
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
I'm sure there's some settings you'll get in trouble for (memory limit 2GB, anyone?), so make sure you're not doing anything odd. Good luck.