Home » Php » bash – PHP Command, not found

bash – PHP Command, not found

Posted by: admin July 12, 2020 Leave a comment


I tried to install composer via PHP command like said in getcomposer site,
But the bash throw an error:

 bash: php: command not found

So I did a search in google , and I came up with some answers,
1) to add php binary file path to $PATH variable
The problem is when I run:

 find / -name php -type f

I get this error:

find: ‘/run/user/1000/gvfs’: Permission denied

Even with sudo and as a root

2) To install tht php-cli package, so I run

 pacman -S php7-cli

But I get this error:

error: target not found: php7-cli

So what it isn’t working for me?

I installed php via XAMPP installer and I’, using manjaro

How to&Answers:

Whenever you install XAMPP, you get all of the Apache, MySQL, PHP stack. The problem is, XAMPP won’t link binaries to your PATH, because your could have another version of that software already installed.

Composer needs a PHP version available on your PATH, so the easier option is to link your already installed version of PHP.

I think you can find your PHP binary in /opt/lamp/bin so you can link it this way:

sudo ln -s /opt/llamp/bin/php /usr/bin/php

Hope it works!

If you want to double check your PHP binary location you can go to files then at the end you can find “other locations” click it and then go and check it.


You may be mixing up linux distributions.

php-cli is, I believe from debian-based distributions.

If you are using manjaro, check this wiki page for how to install php:


Note that arch linux and manjaro are rolling releases, so it will install php7. Many things you find on the web are for lower versions, so be careful!