GodAtum
GodAtum

Reputation: 183

php -v command does not work

I have just installed the php5 package on my Debian system using the standard apt-get. The code:

<?php
phpinfo();
?>

works and other php pages work.

But the commands php -v and php -m do not work. It gives an error "-bash: php: command not found".

php5-cli is installed. My path is /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games. I looked into usr/bin and there is no php or php5 file. Not sure where else those can be located?

I ran:

whereis php5
php5: /etc/php5 /usr/lib/php5 /usr/lib64/php5 /usr/share/php5

Dont think any of those are the correct file?

Upvotes: 2

Views: 11540

Answers (2)

Andrew Sledge
Andrew Sledge

Reputation: 10351

Make sure that the PHP CLI package is installed. sudo apt-get install php5-cli.

Also, the PHP binary needs to be added to your path. If you run which php and get no output, then it is certain that it is not in your path.

Upvotes: 9

jbleners
jbleners

Reputation: 1043

The php command is probably not in your path. You can view your path with echo $PATH. If the directory where the php binary is installed is not in your path, you can set it with export PATH=$PATH:/path/to/php.

Upvotes: 3

Related Questions