PHPDocumentor 2 and PHP 7 with opcache issues in Doctrine

試著忘記壹切 提交于 2019-11-28 10:55:03
deepdivedylan

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.

You can also use composer without manually switching vendors directory contents. Just use:

composer require doctrine/annotations

to have the latest version of doctrine/annotations (at least 1.2.5 solves the problem)

phpDocumentor 2.8.5 is the default version with Ubuntu 16.04. However, php7 support wasn't added until 2.9. I got it working by using the following on the command line:

sudo apt-get install php7.0-mbstring
wget https://github.com/phpDocumentor/phpDocumentor2/releases/download/v2.9.0/phpDocumentor.phar
chmod +x phpDocumentor.phar
sudo mv phpDocumentor.phar /usr/local/bin/phpDocumentor-2.9.phar
sudo ln -s /usr/local/bin/phpDocumentor-2.9.phar /usr/local/bin/phpdoc

If you installed phpDocumentor from pear, use the following to remove it:

sudo pear uninstall phpdoc/phpDocumentor

Thanks deepdivedylan for links. However, composer require --dev phpdocumentor/phpdocumentor did not solve my problem. But reading through the links and downloading doctrine annotations patch 1.2.5 worked fine. Just download archive and replace vendor/doctrine/annotations folder with its contents.

You can download the latest version of phar from github releases .

The link from website is to an older version of it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!