Take the 2-minute tour ×

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.

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

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.

share|improve this answer
Please accept this answer –  AliGibbs Jun 30 '12 at 17:39
add comment

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.

share|improve this answer
add comment

Your Answer


