7
votes

I try to increase the memory_limit of php with Laravel valet.

What I see:

With phpinfo() I see:

  • memory_limit 128M
  • Configuration File (php.ini) Path /usr/local/etc/php/7.4
  • Loaded Configuration File /usr/local/etc/php/7.4/php.ini
  • Scan this dir for additional .ini files /usr/local/etc/php/7.4/conf.d Additional .ini files parsed /usr/local/etc/php/7.4/conf.d/ext-opcache.ini, /usr/local/etc/php/7.4/conf.d/php-memory-limits.ini

What I already do

  • I update php.ini and php-memory-limit.ini to edit the memory_limit from 128M to 256M: memory_limit = 256M

  • Then I have run the following command: valet restart

  • I also try to edit /usr/local/etc/php/7.4/php-fpm.d/valet-fpm.conf to add php_admin_value[memory_limit] = 256M

  • But after that the memory_limit stuck to 128M ( with phpinfo() )

the following command return me 256M: php -i | grep memory_limit

Any idea how to increase this value ?

3
I just modify this file , it works: /usr/local/etc/php/7.4/conf.d/php-memory-limits.ini - Yassine Qoraiche

3 Answers

22
votes

I found a solution but I didn't understand why it works, but not what I did before. If anyone has an explanation, I'm interested.

I edit /usr/local/etc/php/7.4/php-fpm.d/valet-fpm.conf and replace following line php_admin_value[memory_limit] = 128M
With this line
php_admin_value[memory_limit] = 256M

Then I run the following command:

valet restart
brew services restart [email protected]

With just one of these two commands it doesn't work.
However valet restart is supposed to restart php, right?

1
votes

One solution worked with me, editing the file:

/usr/local/etc/php/7.2/conf.d/php-memory-limits.ini

And change the value memory_limit, save and run the command (to make sure it was changed):

php -r "echo ini_get('memory_limit').PHP_EOL;"

Then, restart Valet:

valet restart

0
votes

Check the memory limit using

php -r "echo ini_get('memory_limit').PHP_EOL;"

Then you can check the config file loaded

php --ini

Sometimes there are more than one, so please check all the config files.