How to create a custom PHP.ini for my Dreamhost hosting account?

How do I create a custom PHP.ini for my Dreamhost hosting account? I need to modify the maximum upload file size allowed.

Here are the steps to create a custom php.ini for a Single domain:

First of all, make sure you are able to log into SSH on your Dreamhost account (see detailed instruction to enable SSH on your account.) Then open Terminal (OS X) or Putty (Windows), and login into your hosting account:
password: [type in your account’s admin password]

1. Once logged in, create a cgi-bin folder for your domain:
mkdir $HOME/

2. Copy the default php.ini file:
cp /etc/php5/cgi/php.ini $HOME/

3. Create the script wrapper:
Create a text file in the cgi-bin directory that you created above (/home/yourusername/ named php-wrapper.cgi, containing the following lines:
exec /dh/cgi-system/php5.cgi $*

You can do this with any linux text editor (nano, vi, vim, etc.) in the shell. You can also create this file using your own computer and a *text editor* (not a word processor). Make sure your editor can save the file with unix-style line endings (otherwise the #!/bin/sh line will cause an error!), and then upload it to the /home/yourusername/ directory.

4. Set permissions:
chmod 755 $HOME/
chmod 755 $HOME/
chmod 640 $HOME/

5. Set up the .htaccess file:
The .htaccess file is located in your document root at $HOME/

Add this to run .php files with your custom PHP wrapper:
Options +ExecCGI
AddHandler php5-cgi .php
Action php-cgi /cgi-bin/php-wrapper.cgi
Action php5-cgi /cgi-bin/php-wrapper.cgi

6. You can now modify $HOME/ to your heart’s content!

; Maximum allowed size for uploaded files.
upload_max_filesize = 90M
; Maximum size of POST data that PHP will accept.
post_max_size = 100M

Note: some variables (in particular, post_max_size and upload_max_filesize) are subject to internal limitations; increasing them significantly beyond the default values will not work correctly.

Original solution posted at

To custom php.ini across Multiple domains, see detailed instruction here:

%d bloggers like this: