6

I've installed PHP7, pear and phpdocumentor. Everything look good during the install but when I run phpdoc I receive the following error.

PHP Fatal error:  Uncaught Doctrine\Common\Annotations\AnnotationException: You have to enable opcache.load_comments=1 or zend_optimizerplus.load_comments=1. in /usr/share/php/phpDocumentor/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:193

PEAR Version: 1.10.1
PHP Version: 7.0.9-1+deb.sury.org~trusty+1
Zend Engine Version: 3.0.0
Running on: Linux kevin-lt 3.13.0-46-generic #76-Ubuntu SMP Thu Feb 26
18:52:13 UTC 2015 x86_64

phpDocumentor: 2.8.5

Anybody know how to fix this?

  • Bump! Anybody experience this before? – user1783540 Aug 11 '16 at 21:36
6

If you look at the Pear package https://pear.phpdoc.org/, you will notice that the official package is based on version 2.8.5. This version doesn't support PHP7.0 syntax.

The project has released version 2.9.0 in May and if you want to install it, you'll need to get the version from Github. For example (go into the release tab so as to get the last one) :

wget https://github.com/phpDocumentor/phpDocumentor2/releases/download/v2.9.0/phpDocumentor.phar

Then, you need to follow the manual (Using the PHAR, except that you will replace the one from phpdoc.org by the one from Github)

  1. Download the phar file from http://phpdoc.org/phpDocumentor.phar, or from a release listed on github
  2. Move the file with sudo to your bin directory: sudo mv phpDocumentor.phar /usr/local/bin/phpdoc
  3. Ensure the file has execute rights: sudo chmod +x /usr/local/bin/phpdoc Confirm it runs (you may have to restart your SSH session if you're connecting remotely first) by running phpdoc --version from any directory.
| improve this answer | |
  • +1 for such a simple answer including restart SSH - that was the main problem not stated in similar answers – Datadimension May 7 '17 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.