CakePHP: Allowed memory size exhausted, increasing memory_limit is not helping
Solution 1
ini_set('memory_limit', '-1');
overrides the default PHP memory limit.
Solution 2
Try this code:
ini_set('memory_limit', '1024M');
salouri
Updated on June 05, 2022Comments
-
salouri almost 2 years
Specs = CakePHP 2.4.6, PHP 5.3.13, Windows 7 x64, Apache Server 2.4.9.
I keep getting this error:
Allowed memory size xxxx exhausted
I have tried everything I could find, increasing
memory_limit
ormax_execution_time
inisde php.ini file is not helping no matter how much I increase the limits. My Apache server has openssl enabled (some say it might be related), php_pdo_mysql is enabled too. I am using fastCGI for PHP and it's not helping to switch to php5_module!The strange thing is that it was working on my localhost for a while and not working on the dev server, and recently it's not working on my localhost as well (I started getting execution time error instead sometimes)
Here is the action I am using:
public function index() { $this->Certificate->recursive = 0; $certificates = $this->Certificate->find('all', array( 'conditions' => array('course_id !=' => '1'), 'contain' => array( 'CertificateStatus.status', 'Course.title', 'Student.full_name', 'User.name' ))); $this->set(compact('certificates')); }
Any ideas as to what could be the reason for this problem? how would I find memory leaks in CakePHP? What could be the solution to fix/optimize it?
** New Update:
After limiting the number of "fields" in the
find()
, and after increasing some Fcgid numbers inside httpd, now I can fetch the whole table, but it takes 5 minutes for the page to load completely, which is a failure performance wise!Is this related to CakePHP caching? If yes, is there any way to optimize it for this number of records?? Everyone tells me that 26,000 text records is not a "huge" data set!
-
salouri almost 10 yearsI tried this one before, and then I get the error:
Maximum execution time of 60 seconds exceeded
(I increased it from 30 to 60 seconds) -
bancer over 3 yearsWhy in I18N.php? Is it because I18N.php is memory hungry?