composer 报错Allowed memory size解决

本文解决在使用Composer执行包相关命令时遇到的内存溢出错误,详细介绍了错误信息及如何通过调整PHP内存限制来解决问题。

composer 对包执行相关命令,报错
PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 4096 bytes)

命令行执行:

#composer 必须是全路径
php -d memory_limit=-1 /tmp/composer require kmf/ip-server
2025/06/23 14:14:53 [error] 185042025/06/23 14:14:53 [error] 18504#0: *40688 FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 991232 bytes) in /home/data/baota/wwwroot/yijian.sdhuan.cn/vendor/monolog/monolog/src/Monolog/Logger.php on line 329 PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /home/data/baota/wwwroot/yijian.sdhuan.cn/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php on line 202" while reading response header from upstream, client: 223.104.194.134, server: yijian.sdhuan.cn, request: "POST /addons/yun_shop/api.php?i=1&uuid=0&type=5&shop_id=null&basic_info=1&validate_page=1&scope=home&route=meal.home.getHomeFirstCategory HTTP/2.0", upstream: "fastcgi://unix:/tmp/php-cgi-72.sock:", host: "yijian.sdhuan.cn", referrer: "https://yijian.sdhuan.cn/addons/yun_shop/?menu=" 2025/06/23 14:14:53 [error] 18504#0: *40688 FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 991232 bytes) in /home/data/baota/wwwroot/yijian.sdhuan.cn/vendor/monolog/monolog/src/Monolog/Logger.php on line 329 PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /home/data/baota/wwwroot/yijian.sdhuan.cn/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php on line 202" while reading response header from upstream, client: 223.104.194.134, server: yijian.sdhuan.cn, request: "POST /addons/yun_shop/api.php?i=1&uuid=0&type=5&shop_id=null&validate_page=1&scope=home&route=meal.home.getHomeThirdCategory HTTP/2.0", upstream: "fastcgi://unix:/tmp/php-cgi-72.sock:", host: "yijian.sdhuan.cn", referrer: "https://yijian.sdhuan.cn/addons/yun_shop/?menu=" 2025/06/23 14:14:53 [error] 18504#0: *40688 FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 991232 bytes) in /home/data/baota/wwwroot/yijian.sdhuan.cn/vendor/monolog/monolog/src/Monolog/Logger.php on line 329 PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /home/data/baota/wwwroot/yijian.sdhuan.cn/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php on line 43" while reading response header from upstream, client: 223.104.194.134, server: yijian.sdhuan.cn, request: "POST /addons/yun_shop/api.php?i=1&uuid=0&type=5&shop_id=null&validate_page=1&scope=home&route=coupon.member-coupon.coupons-for-member HTTP/2.0", upstream: "fastcgi://unix:/tmp/php-cgi-72.sock:", host: "yijian.sdhuan.cn", referrer: "https://yijian.sdhuan.cn/addons/yun_shop/?menu="报错是什么意思,怎么解决
06-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值