0

I have an almost new CPanel installation on 64-bit Centos 5.7. It is on a VPS with 2G of RAM. In the php.ini file, the memory_limit=256M. Despite these relatively large limits, I'm getting out-of-memory errors doing simple things like connecting to mysql. I've rebuilt Apache and PHP multiple times, and the only extra extensions enabled are gd and mysql.

CPanel plugins are MailScanner and Firewall.

Sample Error: Fatal error: Out of memory (allocated 7077888) (tried to allocate 1966080 bytes)

I've checked the code and there are no odd loops or anything that could be consuming that amount of memory, and the server has almost zero load. (Only thing that appears to be using any CPU is the MailScanner) Any ideas of what to check would be helpful.

My php.ini (verified with phpinfo()) max_execution_time = 30 max_input_time = 60 memory_limit = 256M

Originally we had the suphp extension installed, but with that we could not even get a simple phpinfo() page to come up. Once I removed the suphp extension, very simple pages worked (things that just include()ed other files, but most other operations caused out-of-memory errors.

2 Answers 2

1

Are you sure it's loading that php.ini? 1966080 bytes is less than 2mb (unless I am getting that wrong). If you have command line access, run: php -i | grep php.ini

they should give you the line which specifies which php.ini is being used.

0

I found the issue and just wanted to post in case anyone else came across the same thing. It ended up being a permissions problem in the directory Smarty used to pre-compile the templates. Apparently if Smarty does not have the proper permissions to access the temp directory for template compilation, it tries to do it all in memory and if the page is too large it will throw the out-of-memory error. After resetting the permissions on the template_c and cache directories, everything started working properly.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .