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.

Apache Web server: Too many levels of symbolic links

After having this error presented to myself recently I thought it would be handy to let others know what it means!

So you’ve tried to restart/reload/start Apache on your Linux box and the following error has come up:

Too many levels of symbolic links

This is caused by one or more of the symlinks in the sites-enabled dir linking to its-self (maybe not directly but eventually ends up there :-(). I had my created my symlink using the command:

 ln -s <target> <destination>

But when I created the symlink my working directory was the same location as the file I wanted to link to, so I just typed:

ln -s somefile /var/somedir/somefile_link

Turns out this does not quite do as I had expected. (although not sure why)

The Solution

Basically the answer is to delete the symbolic link and start again this time using full path name, then is should all work:

ln -s /etc/apache2/sites-available/somefile /var/somedir/somefile_link