微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PHP致命错误:允许的内存大小为1073741824字节耗尽(尝试分配16777216字节)

我在我的16 GB Mac Book Pro上运行了composer install,我得到了这个

 ⚡️  distributor-portal  composer install                                                                                                       
Loading composer repositories with package information
Updating dependencies (including require-dev)                      
PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 16777216 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.PHP on line 220

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 16777216 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.PHP on line 220

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.⚡️  distributor-portal 

哪个PHP

/usr/local/PHP5/bin/PHP

PHP –version

PHP 7.1.4 (cli) (built: May  6 2017 10:02:00) ( NTS )
copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.4, copyright (c) 1999-2017, by Zend Technologies

cd /usr/local /; ls -lrt

total 0
lrwxr-xr-x    1 root   wheel    26B Jan 23  2017 openssl@ -> mac-dev-env/openssl-1.1.0c
lrwxr-xr-x    1 root   wheel    37B Jul  5  2017 PHP5@ -> /usr/local/PHP5-7.1.4-20170506-100436
lrwxr-xr-x    1 root   wheel    30B Oct  9  2017 MysqL@ -> MysqL-5.7.19-macos10.12-x86_64
-rw-r--r--    1 root   wheel     0B Dec 12 14:47 .com.apple.installer.keep
drwxr-xr-x@  10 root   wheel   320B Dec 12 15:51 ../
drwxr-xr-x    3 root   wheel    96B Dec 12 15:52 mac-dev-env/
drwxr-xr-x    3 root   wheel    96B Dec 12 15:53 remotedesktop/
drwxr-xr-x   21 root   wheel   672B Dec 12 15:53 ./
drwxr-xr-x   15 bheng  admin   480B Dec 12 15:53 etc/
drwxr-xr-x   14 501    wheel   448B Dec 12 15:54 packager/
drwxr-xr-x   25 bheng  admin   800B Dec 12 15:54 share/
drwxr-xr-x   14 root   wheel   448B Dec 12 15:54 PHP5-7.1.4-20170506-100436/
drwxr-xr-x   71 bheng  admin   2.2K Dec 12 15:54 Cellar/
drwxr-xr-x   11 bheng  admin   352B Dec 12 15:54 var/
drwxr-xr-x  396 bheng  admin    12K Dec 12 15:54 bin/
drwxr-xr-x   13 bheng  admin   416B Dec 12 15:54 PHP5-5.6.14-20151002-085853/
drwxr-xr-x   80 bheng  admin   2.5K Dec 12 15:54 opt/
drwxr-xr-x   13 root   wheel   416B Dec 12 15:54 MysqL-5.7.19-macos10.12-x86_64/
drwxr-xr-x   17 bheng  admin   544B Dec 12 15:54 Homebrew/
drwxr-xr-x  122 bheng  admin   3.8K Dec 12 15:54 include/
drwxr-xr-x  231 bheng  admin   7.2K Dec 12 15:54 lib/

问题

如何进行并进一步调试?

我现在对任何建议持开放态度.

任何提示/建议/帮助将非常感谢!

解决方法:

您的计算机可能已安装16GB但PHP未配置为使用它.找到你的PHP.ini文件(在OSX上用Homebrew安装的PHP在/usr/local/etc/PHP/$PHP_VERSION/PHP.ini.用编辑器打开它并搜索memory_limit.你在那里指定PHP的内存量进程可以使用.如果你想将它全部改为将值改为-1.

$PHP_VERSION是PHP安装的版本.要弄清楚哪个安装使用PHP –version.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐