6

Although I followed the instruction to install phpDocumentor, Command line doesn't seem to respond to phpdoc

Given error: Command 'phpdoc' not found, did you mean: command 'phploc' from deb phploc command 'phpdox' from deb phpdox Try: sudo apt install

I followed these steps to install phpdoc and it seemed to work

pear channel-discover pear.phpdoc.org

pear install phpdoc/phpDocumentor

When the installation completed I tried to run phpdoc -h and it did not work.

Using: 7.2.16

OS: Ubuntu 18.04.2 LTS

I appreciate any attempt to help.

Agil
  • 346
  • 4
  • 20
  • Could you check the section *Modifying php.ini* from the pear documentation and try to check if that works. https://pear.php.net/manual/en/installation.checking.php – JensV Apr 11 '19 at 09:15
  • Did you `sudo` those install commands? (Just curious, I just installed on Linux Mint 18.1 without problems) Did you try any of the other installation methods? – brombeer Apr 11 '19 at 09:22
  • Yes, but it doesn't look like the problem is with the installation @kerbholz – Agil Apr 11 '19 at 09:23
  • @JensV I actually added `include_path=".:/home/user/pear/share/pear"` manually. but it doesn't have anything to do with `phpdoc` am I right? beacouse `pear` already works. – Agil Apr 11 '19 at 09:25
  • What does `whereis phpdoc` return? Is that path in your `PATH`? (Mine says `phpdoc: /usr/bin/phpdoc`) – brombeer Apr 11 '19 at 09:26
  • `phpdoc:` followed by nothing, can I add it manually? – Agil Apr 11 '19 at 09:27
  • It seems like it actually didn't get installed correctly. As kerbholz points out, there should be a binary there. Either `/usr/bin` isn't in your `$PATH` (check with `echo $PATH`) which is very unlikely, or something went wrong with the installation. Try to reinstall it, making sure you run it as root. Also pay attention to any potential error messages returned by pear. – JensV Apr 11 '19 at 09:31
  • Ok I'm trying it now – Agil Apr 11 '19 at 09:32
  • @JensV I tried it and it gave the message `install ok` as it's supposed to, but still no progress – Agil Apr 11 '19 at 09:35

1 Answers1

1

Check directories in your your path with

echo $PATH

phpdoc should be in /usr/bin. Check it with

ls -l /usr/bin/php*

If phpdoc is there, add exec perms with

chmod +x /usr/bin/phpdoc

But most likely he is not in the path, so go for a search

find . -name testfile.txt

When you have identified where phpdoc is, you must either add the folder where it is located to the PATH, or create a symbolic link (symln :

to this file in a directory of the PATH.

For PATH extension, do :

export PATH=$PATH:/my/custom/path

For a symlink, cd to a directory in your PATH. After that do

ln -s /my/custom/path/phpdoc

A good custom binary directory is /usr/local/bin.

You have to perform all this task as root or with sudo.