Custom PHP on Dreamhost with CakePHP

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.

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.

Tags

Comments

[RSS]

1 Gabriel said on 18/5/09:
Hi! I'm trying to do someting like that. I'm using dreamhost too, but i have one cakephp core shared amongst multiple domains. I need to upload files larger than the 7Mb dreamhost limit. I used this guide [http://wiki.dreamhost.com/Advanced_PHP_configuration] and works fine with standalone php files, but can't get it working with cakephp. I have only two .htaccess files (/.htaccess and /webroot/.htaccess) in the domain and when I added these lines I get a 500 error: Options ExecCGI AddHandler php5-cgi .php Action php5-cgi /php5/php5.cgi Maybe you can help me to configure the .htaccess files. Thanks a lot and sorry by my english.
2 alanic said on 25/5/09:
A better solution I found is to stick RewriteCond %{REQUEST_FILENAME} !^.*fcgi$ before each RewriteRule line and don't make it try and rewrite your fcgis.
3 Scott said on 7/9/09:
Thanks for this. DH really screwed me up when they moved everyone to 64b servers and broke custom php. This helped tremendously.
4 chext0r said on 23/9/09:
Hi, is there any way to get this working with FastCGI?

Leave a Comment