Changing PHP settings with FastCGI and suPHP

Recently I needed to change the upload_max_filesize for php running on one of my sites. As this can only be done in either .htaccess (when running php as an apache module) or using php.ini, I was forced to use the php.ini method.

So I created a new php.ini file and added the following lines:

upload_max_filesize = 32M
post_max_size = 64M

The post max size all ways needs to be greater than the upload max filesize other wise the upload max filesize can never be reached as it will get limited by the post max size before hand. Uploaded this to the server and I a look at the phpinfo() output. But still the post_max_size was set to 2MB.

After scouring the internet for quite a while wondering why my php.ini file was not being picked up by php running in FastCGI mode I finally discovered I had to add an extra line into my .htaccess file to tell suPHP where to find my php.ini file.

I opened up my .htaccess file directly under my web root and added the line:

suPHP_ConfigPath /<path to my public_html>/public_html

And like magic PHP picked up the new php settings and the upload_max_filesize went upto 32MB.

I hope this helps someone else having the same issue solve it far quicker than I did.