允许的内存大小为134217728字节已耗尽(尝试分配 20480 字节) Laravel

2022-08-31 00:05:09

我对拉拉维尔有问题。重新启动系统后,我的项目将无法运行!!!

我运行 ,但我在控制台中有以下消息:php artisan serv

[Tue Jul  3 14:31:35 2018] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /laravel-projects/blog/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 122
[Tue Jul  3 14:31:35 2018] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /laravel-projects/blog/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php on line 46
[Tue Jul  3 14:31:38 2018] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /laravel-projects/blog/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 122
[Tue Jul  3 14:31:39 2018] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /laravel-projects/blog/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php on line 46
[Tue Jul  3 14:31:39 2018] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /laravel-projects/blog/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 122

在系统恢复之前,该项目得到了很好的实施!


答案 1

这意味着您还需要更新php.ini指令。memory_limit

尝试放入你的 php.ini :

memory_limit=1024M并重新启动apache

sudo systemctl restart httpd.service


答案 2

更改文件夹内的哪个php.iniapache2

memory_limit=1024M

restart apache2

您甚至可以通过以下方式检查哪个php ini配置正在使用:

php -i | grep "php.ini"

推荐