这是我以前从未发生过的事情。
我收到Allowed memory size of X bytes exhausted
,但是我的脚本几乎不占用任何内存。
我用最少的代码创建了一个小的测试脚本,但是它仍然失败!
$ cat x.php
#!/usr/bin/env php
<?php
function ha($msg) {
}
ha("Hi");
$ ./x.php
Fatal error: Allowed memory size of 62914560 bytes exhausted (tried to allocate 1081028648 bytes) in x.php on line 4
有趣的是,如果删除函数的$msg
参数,则不会发出警告。如前所述,我从未发生过这种情况。 php.ini
也很正常。
系统信息:
$ php -v
PHP 5.6.19 (cli) (built: Jun 22 2016 20:13:44)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
$ php -m
[PHP Modules]
bcmath
calendar
Core
ctype
date
dom
ereg
exif
filter
gd
hash
json
libxml
mbstring
openssl
pcntl
pcre
PDO
pdo_sqlite
posix
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
$ df -h
Filesystem Size Used Available Use% Mounted on
ubi0:rootfs 362.9M 122.2M 240.7M 34% /
tmpfs 40.0K 0 40.0K 0% /mnt/.splash
none 1.0M 116.0K 908.0K 11% /dev
/dev/sda1 56.8G 5.4G 48.5G 10% /media/sda1
tmpfs 50.0M 72.0K 49.9M 0% /var/volatile
tmpfs 123.9M 0 123.9M 0% /dev/shm
tmpfs 20.0M 0 20.0M 0% /media/ram
$ cat /proc/meminfo
MemTotal: 253712 kB
MemFree: 179720 kB