PHPDocumentor 2和PHP 7在Doctrine中存在opcache问题 [英] PHPDocumentor 2 and PHP 7 with opcache issues in Doctrine
问题描述
希望这里的人对此有所了解或了解2.
Hopefully someone here knows a thing or 2 about this.
简短问题
我在命令行中使用phpdoc遇到了错误,该错误是通过梨在PHP 7.0.2上安装的.错误是:
I am running into an error using phpdoc on the command line, installed via pear on PHP 7.0.2. The error is:
#> phpdoc
PHP Fatal error: Uncaught Doctrine\Common\Annotations\AnnotationException:
You have to enable opcache.load_comments=1 or zend_optimizerplus.load_comments=1.
in /usr/local/php5-7.0.2-20160108-102134/lib/php/phpDocumentor/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:193
如何解决此错误?
详细信息
Opcache已启用,并且opcache.load_comments=1
在我的opcache.ini文件中,分别使用以下命令进行了验证:php -i | grep "Opcode"
和php -i | grep "opcache"
.在该.ini文件中,我可以通过选中通过该文件启用和禁用opcache来验证更改是否已加载.
Opcache is enabled and opcache.load_comments=1
is in my opcache.ini file, verified by using the commands: php -i | grep "Opcode"
and php -i | grep "opcache"
respectively. Within that .ini file I can verify that changes are loaded by checking enable and disable opcache via that file.
话虽如此,如果我的.ini文件中包含opcache.load_comments=1
,为什么我仍然出现此错误?
With that said, if I have opcache.load_comments=1
in my .ini file, why am I still getting this error?
谢谢!
推荐答案
在使用PHPDocument的PHAR版本时,我遇到了相同的问题. PHAR包含过时的版本的《教义注释》.
I encountered the same problem while using the PHAR version of PHPDocumentor. The PHAR includes an obsolete version of Doctrine Annotations.
较旧版本的Annotations引用了php.ini
中的opcache.load_comments
设置,该设置在PHP 7中不存在:
The older version of Annotations is referring to the opcache.load_comments
setting in php.ini
, which does not exist in PHP 7:
此问题已在注释"的上游修复:
This has been fixed upstream in Annotations:
目前,通过执行composer require --dev phpdocumentor/phpdocumentor
使用PHPDocumentor的作曲者版本为我解决了该问题.
For now, using the composer version of PHPDocumentor by executing composer require --dev phpdocumentor/phpdocumentor
resolved the problem for me.
这篇关于PHPDocumentor 2和PHP 7在Doctrine中存在opcache问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!