1
votes

PHP Fatal Error 'yii\base\ErrorException' with message 'Allowed memory size of 25165824 bytes exhausted (tried to allocate 305708 bytes)

codeception.yml says:

memory_limit: 512M

php.ini says:

memory_limit=512M

ini_get('memory_limit') confirms 512M

Here is my test: https://gist.github.com/nsanden/35ea7457bf3c4e9078b5

Here is my codecept run debug https://gist.github.com/nsanden/5ee34b54376f066b9331

Seems codeception won't allow my test to run because its using more than 25MB... Can't seem to allow it more memory.

Running on windows with php 5.6.3 and latest phpunit/codeception

1
Which php.ini says 512M? If you're running from the command line, then you're probably using a different php.ini than the web SAPI - Mark Baker
Mark - yes! Why didn't I think of that... So you're saying codeception might be using its own PHP - Nate
Not its own PHP, but you're running it from the command-line, so it will be using the command-line version of php.ini - Mark Baker
I'm using xampp if your familiar with its php.ini setup but in any case, when i do a echo php_ini_loaded_file() in my test, it tells me that its using the same ini file as the one i've got my 512M limit set. Also, it appears codeception is ignoring that limit anyway and using the limit I set in the codeception.yml. I know this because, I see in the codeception source code that it is doing an ini_set('memory_limit', mysetting) call right before it runs the test. - Nate
Yep this confirms it: $ php -r "echo php_ini_loaded_file();" C:\xampp\php\php.ini - Nate

1 Answers

4
votes

For those who came from google because this question is the first result (like me), if you are missing the codeception.yml setting which determines the memory_limit in runtime (unlike @Nate),

Add the following inside codeception.yml

settings:
    memory_limit: 4096M