Current time: 11-23-2024, 12:17 PM Hello There, Guest! (LoginRegister)


Post Reply 
limiting memory per user / php-cgi process
Author Message
Catscrash Offline
Junior Member
*

Posts: 27
Joined: Oct 2008
Reputation: 0
Post: #1
limiting memory per user / php-cgi process
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
(This post was last modified: 10-14-2011 10:04 PM by Catscrash.)
10-14-2011 09:33 PM
Find all posts by this user Quote this message in a reply
willrain Offline
Junior Member
*

Posts: 62
Joined: Jul 2010
Reputation: 1
Post: #2
RE: limiting memory per user / php-cgi process
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.
10-15-2011 04:14 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Catscrash Offline
Junior Member
*

Posts: 27
Joined: Oct 2008
Reputation: 0
Post: #3
RE: limiting memory per user / php-cgi process
what would i need to enter in the limits.conf? thx
10-15-2011 05:54 PM
Find all posts by this user Quote this message in a reply
willrain Offline
Junior Member
*

Posts: 62
Joined: Jul 2010
Reputation: 1
Post: #4
RE: limiting memory per user / php-cgi process
Comments in the limits.conf is not enough?
10-15-2011 10:49 PM
Visit this user's website Find all posts by this user Quote this message in a reply
davidcafe Offline


Posts: 1
Joined: Oct 2011
Reputation: 0
Post: #5
RE: limiting memory per user / php-cgi process
(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');
10-21-2011 09:17 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)