Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php -v command does not work

Tags:

php

debian

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?

like image 725
GodAtum Avatar asked Dec 18 '25 18:12

GodAtum


1 Answers

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.

like image 89
Andrew Sledge Avatar answered Dec 21 '25 08:12

Andrew Sledge