I installed php7.1 using the iuscommunity repo. It works fine and I can run php files via apache normally e.g. http://example.com/test.php, however I cannot find the executable, if I run:

php -v
-bash: php: command not found

If I look at the php constants, the path shows but not the binary. There is no php binary in my /usr/bin:

// result:
string(0) ""
string(8) "/usr/bin"

If I use find I get the below results, but none of them are the php binary. If I try to execute them it tells me it's a directory.

find / -name php -print


How can I find my php 7.1 binary? I need it to run php from the CLI.

  • are you able to run /usr/lib64/php -v? if so just add it to your path variable – Martin Barker Apr 5 at 14:00
  • No it says it's a directory: -bash: /usr/lib64/php: Is a directory – user69904 Apr 5 at 14:09
  • 2
    PHP's CLI is often a separate package. – ceejayoz Apr 5 at 14:15

Thanks to @ceejayoz for pointing out that the CLI can be a seperate package.

I installed php71u-cli:

yum install php71u-cli

Now I can run php -v successfully.

  1. locate PHP bin directory
  2. create link to /usr/bin

In my case my php installed in "/opt/php/bin". So i just create link "ln -s /opt/php/bin/php /usr/bin/php". After this i can run php -v

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.