If you are getting “too many open files” error this  is how to fix it.

To change the file descriptor setting you need to add the line fs.file-max=50000 to the kernel parameters file /etc/sysctl.conf

echo "fs.file-max = 500000” >> /etc/sysctl.conf


Open /etc/sysctl.conf file with any editor and add the fs.file-max=50000  line to the file.

To apply all changes run the following command:

sysctl -p

The final step is to change the ulimit setting hard and soft limits. Continue Reading…

A little while ago  I ran into memory problems on an VPS.  It turned out to be due to the GD library having issues with large images.
I  discovered is that the PHP memory limit  only applies to actual PHP code and not C libraries like GD that are called from PHP.
To put a cap on the memory usage of Apache I set process limits for the main Apache process  using ulimit.

On Debian this can be done by adding this to the bottom of /etc/default/apache2:

ulimit -v 1048576

NOTE:  This is for a limit of 1GB of virtual memory.


Page 1 of 11