I cannot find the dreamhost wiki article anymore, but I came across the files described below a couple of years ago when trying to add php.ini to some domains from a location that blocked me from using the needed SSH session required for most of the other php/php.ini wiki articles.
On domains where I want a custom php.ini so I can edit some settings I simply drop two files into the root of that domain before setting up the web application and access the php file via a web browser and voila, php.ini is setup.
As I cant attach files here, I will post the text and you can save it as the relevant type. Save everything in between (but not including) the line of =============== at the top and bottom of each list of commands.
FILE 01: save as custom_php_ini.php
==============================================
<?php
shell_exec('chmod 755 custom_php_ini.sh');
$mode=$_GET['mode'];
$command="./custom_php_ini.sh $mode";
if($mode == "" || $mode == "test" || $mode == "php4" || $mode == "php5")
{
$output = shell_exec($command);
}
echo "<pre>$output</pre>";
?>
<FORM ACTION="custom_php_ini.php" METHOD=GET>
<select name="mode">
<option value="test">Test</option>
<option value="php5">PHP5</option>
<option value="php4">PHP4</option>
</select>
<input type="submit" value="Select">
</FORM>
==============================================
FILE 02: save as custom_php_ini.sh
==============================================
#!/bin/sh
path=`pwd`
if [ -z "$1" ]; then
echo "Usage: $0 <argument>"
echo
echo "Arguments:"
echo "test: test to make sure things look good"
echo "php4: install custom php4"
echo "php5: install custom php5"
exit 1
fi
if [ $1 = "test" ]
then
echo Path to your domain is: $path
echo
echo "To execute:"
echo mkdir $path/cgi-bin
echo cp -pvf /dh/cgi-system/phpX.cgi $path/cgi-bin/php.cgi
echo cp -vf /etc/phpX/cgi/php.ini $path/cgi-bin/php.ini
echo cat $path/.htaccess ">" $path/.htaccess.temp
echo echo AddHandler php-cgi .php ">" $path/.htaccess
echo echo Action php-cgi /cgi-bin/php.cgi ">>" $path/.htaccess
echo echo ">> "$path/.htaccess
echo cat $path/.htaccess.temp ">>" $path/.htaccess
echo rm $path/htaccess.temp
echo
echo chmod 644 $path/.htaccess
echo chmod 755 $path/cgi-bin
echo chmod 750 $path/cgi-bin/php.cgi
echo chmod 644 $path/cgi-bin/php.ini
echo wget -O $path/info.php http://dhspeedtest.com/info.txt
fi
if [ $1 = "php4" ]
then
mkdir $path/cgi-bin
cp -pvf /dh/cgi-system/php.cgi $path/cgi-bin/php.cgi
cp -vf /etc/php/cgi/php.ini $path/cgi-bin/php.ini
cat $path/.htaccess > $path/.htaccess.temp
echo AddHandler php-cgi .php > $path/.htaccess
echo Action php-cgi /cgi-bin/php.cgi >> $path/.htaccess
echo >> $path/.htaccess
cat $path/.htaccess.temp >> $path/.htaccess
rm $path/.htaccess.temp
chmod 644 $path/.htaccess
chmod 755 $path/cgi-bin
chmod 750 $path/cgi-bin/php.cgi
chmod 644 $path/cgi-bin/php.ini
wget -O $path/info.php http://dhspeedtest.com/info.txt
fi
if [ $1 = "php5" ]
then
mkdir $path/cgi-bin
cp -pvf /dh/cgi-system/php5.cgi $path/cgi-bin/php.cgi
cp -vf /etc/php5/cgi/php.ini $path/cgi-bin/php.ini
cat $path/.htaccess > $path/.htaccess.temp
echo AddHandler php-cgi .php > $path/.htaccess
echo Action php-cgi /cgi-bin/php.cgi >> $path/.htaccess
echo >> $path/.htaccess
cat $path/.htaccess.temp >> $path/.htaccess
rm $path/.htaccess.temp
chmod 644 $path/.htaccess
chmod 755 $path/cgi-bin
chmod 750 $path/cgi-bin/php.cgi
chmod 644 $path/cgi-bin/php.ini
wget -O $path/info.php http://dhspeedtest.com/info.txt
fi
==============================================
When you have saved these files as custom_php_ini .php and .sh simply drop them into the root of the relevant directory (eg. /home/<user>/<domain>/) and navigate to http://<domain>/custom_php_ini.php on your web browser. Its an old file so offers php4 or php5 but simply choose php5 and hit the submit button and your cgi folder, php.ini and htaccess are created. For htaccess it creates or adds the following line to the .htaccess file
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi
I can then edit php.ini to my hearts content .......