php74下请求错误集合:
- php7.4 提交post请求,结果报下面的错误
2023/09/20 15:51:48 [error] 1044#1044: *1194 FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /home/k8s/code/test.com/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php on line 447PHP message:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65536 bytes) in /home/k8s/code/test.com/vendor/symfony/error-handler/DebugClassLoader.php on line 349" while reading response header from upstream, client: 127.0.0.1, server: test.local, request: "POST /event/proposal/create/04d4a042b713404738d190ce39875f7f HTTP/1.1",
upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "test.local", referrer: "http://test.local/event/proposal/create/04d4a042b713404738d190ce39875f7f"
肯定是要修改memory_limit的值,有两个地方有php.ini
一个是: /etc/php/7.4/fpm下的php.ini,还有一个是:/etc/php/7.4/cli 下的php.ini,我么应该修改fpm下的php.ini的memory_limit=1024M,而不是cli的那个,否则不生效。
还是那个问题: cli用于命令行,fpm 用户web请求.
如下命令行可以以体现:
k8s@HPDEV-31:/etc/php/7.4$ php --ini
Configuration File (php.ini) Path: /etc/php/7.4/cli
Loaded Configuration File: /etc/php/7.4/cli/php.ini
Scan for additional .ini files in: /etc/php/7.4/cli/conf.d
Additional .ini files parsed: /etc/php/7.4/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.4/cli/conf.d/10-opcache.ini,
/etc/php/7.4/cli/conf.d/10-pdo.ini,
...
...
