Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
415 views
in Technique[技术] by (71.8m points)

phpdoc - PHPDocumentor 2 and PHP 7 with opcache issues in Doctrine

Hopefully someone here knows a thing or 2 about this.

Short Question

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 DoctrineCommonAnnotationsAnnotationException: 
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

How do I fix this error?

Details

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.

With that said, if I have opcache.load_comments=1 in my .ini file, why am I still getting this error?

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I encountered the same problem while using the PHAR version of PHPDocumentor. The PHAR includes an obsolete version of Doctrine Annotations.

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:

For now, using the composer version of PHPDocumentor by executing composer require --dev phpdocumentor/phpdocumentor resolved the problem for me.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...