我是OSx的新手,并且遇到了我的php安装和SPL功能问题。有时候,当我试图通过apache访问symfony项目时,我得到了下面显示的错误。OSx php7.1问题
当spl_autoloader试图加载ParameterBag类:
Warning: class_implements(): Class /.[^.]+.twig$/ does not exist and could not be loaded
堆栈跟踪:
1 in DebugClassLoader.php line 243
2 at ErrorHandler->handleError('2', 'class_implements(): Class /\.[^.]+\.twig$/ does not exist and could not be loaded', '/Users/mtertishniy/sites/dvsota/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php', '243', array('class' => 'Symfony\Component\HttpFoundation\ParameterBag', 'file' => '/Users/mtertishniy/sites/dvsota/vendor/composer/../symfony/symfony/src/Symfony/Component/HttpFoundation/ParameterBag.php', 'exists' => true, 'refl' => object(ReflectionClass), 'name' => 'Symfony\Component\HttpFoundation\ParameterBag', 'notice' => array(), 'len' => '8', 'ns' => 'Symfony\', 'parent' => false, 'parentInterfaces' => array('/\.[^.]+\.twig$/' => '1'), 'deprecatedInterfaces' => array(), 'interface' => '/\.[^.]+\.twig$/'))
3 at class_implements('/\.[^.]+\.twig$/') in DebugClassLoader.php line 243
4 at DebugClassLoader->loadClass('Symfony\Component\HttpFoundation\ParameterBag')
5 at spl_autoload_call('Symfony\Component\HttpFoundation\ParameterBag') in Request.php line 247
其他奇怪的错误:
OutOfMemoryException in DebugClassLoader.php line 243:
Error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 140495632205216 bytes)
我已经调试这个错误,结果发现,这种情况下自动加载器试图加载格式错误的界面:
我已经从brew中安装了httpd和PHP 7.1。
我的PHP模块:
$ php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imagick
intl
json
ldap
libxml
mbstring
mcrypt
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xdebug
xml
xmldiff
xmlreader
xmlrpc
xmlwriter
xsl
yaml
zip
zlib
[Zend Modules]
Xdebug
如何解决这个问题呢?
我也觉得,你是对的 – KorozCo
@KorozCo我使用与我的Linux服务器相同的限制,一切正常。 140495632205216 bytes = 140495,63220521601 GB。这不是主要问题。 问题是脚本在随机时间停止工作(有关上述名称的问题)。 例如,对于请求1,一切正常,但请求2和3,出现问题,然后再次良好。当DebugClassLoader尝试加载SPL接口时(这些名称似乎是错误的解析),这种情况是偶然发生的! – koninka
@koninka,您是否尝试限制128MB或256MB或512MB? –