ispCP - Board - Support
limiting memory per user / php-cgi process - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Support Area (/forum-30.html)
+--- Forum: System Setup & Installation (/forum-32.html)
+--- Thread: limiting memory per user / php-cgi process (/thread-15332.html)



limiting memory per user / php-cgi process - Catscrash - 10-14-2011 09:33 PM

I seem to have a problem in one of my clients php-scripts. every now and then it starts eating up all 8G of memory and the 2g of swap as well. It's always the same user and only one php-cgi process.

Until the user fixes that script, what can i do to prevent one process from eating up all the system's memory?

And why doesn't the "memory_limit = 512M" setting in /var/www/fcgi/user/php5/php.ini work? A phpinfo.php in the users page shows

memory_limit 512M 512M

thanks for any help


RE: limiting memory per user / php-cgi process - willrain - 10-15-2011 04:14 AM

Quote: And why doesn't the "memory_limit = 512M" setting in /var/www/fcgi/user/php5/php.ini work?
Maybe because it's limit for php script, not for cgi process, which can process few php scripts (and any of them can consume up to 512 Mb). Use /etc/security/limits.conf to set global limits.


RE: limiting memory per user / php-cgi process - Catscrash - 10-15-2011 05:54 PM

what would i need to enter in the limits.conf? thx


RE: limiting memory per user / php-cgi process - willrain - 10-15-2011 10:49 PM

Comments in the limits.conf is not enough?


RE: limiting memory per user / php-cgi process - davidcafe - 10-21-2011 09:17 PM

(10-14-2011 09:33 PM)Catscrash Wrote:  I seem to have a problem in one of my clients php-scripts. every now and then it starts eating up all 8G of memory and the 2g of swap as well. It's always the same user and only one php-cgi process.

Until the user fixes that script, what can i do to prevent one process from eating up all the system's memory?

And why doesn't the "memory_limit = 512M" setting in /var/www/fcgi/user/php5/php.ini work? A phpinfo.php in the users page shows

memory_limit 512M 512M

thanks for any help
For solving your problem you can do some steps may be it will help you.

1. Changing memory_limit globally from php.ini
This is the simplest and most obvious method. You just edit your php.ini and change the memory_limit to whatever you need. For ex:
memory_limit = 32M
2. Changing memory_limit using .htaccess for a single folder/vhost
php_value memory_limit 64M
3. Changing memory_limit inside a single php script.
ini_set('memory_limit', '64M');