Search code examples
phppearmacos-sierraphpdoc

PHP Doc not working on Mac OS Sierra


This is my configuration for pear and I will get this error while I'm executing php doc command. Im on Mac OS Sierra and my php -v is PHP 5.6.30 (cli) (built: Feb 7 2017 16:18:37)

phpdoc --filename first-doc.php -t docs
PHP Warning:  require(PhpDocumentor/phpDocumentor/phpdoc.inc): failed to open stream: No such file or directory in /usr/local/bin/phpdoc on line 40
PHP Fatal error:  require(): Failed opening required 'PhpDocumentor/phpDocumentor/phpdoc.inc' (include_path='.:') in /usr/local/bin/phpdoc on line 40

enter image description here Please help


Solution

  • At a minimum, your PHP configuration's include_path does not contain the main PEAR php_dir location.

    Note the error message shows (include_path='.:'), meaning it only contains your current directory you're in right now in the shell.

    Your PEAR config shows that php_dir is set to /usr/lib/php, so that needs to be added to the include_path setting in your php.ini file.

    I'm actually surprised that PEAR would install anything successfully without the include_path set correctly, as the PEAR program itself should be having trouble running itself. Perhaps the include_path was misconfigured after things were installed.