Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I've currently installed CentOS (6.5 version), nginx, mysql and php. I've tried to navigate to index.php in a browser, and it looks fine, but if I try to run the script via the command-line I get:

php: command not found

Why did that happen? How can I solve it?


Edit: I tried to install the php-cli package:

# yum install php-cli
Error: Package: php-cli-5.3.3-40.el6_6.x86_64 (updates)Requires: php-common(x86-64) = 5.3.3-40.el6_6
           Installed: php-common-5.4.35-1.el6.remi.x86_64 (@remi)
               php-common(x86-64) = 5.4.35-1.el6.remi
           Available: php-common-5.3.3-38.el6.x86_64 (base)
               php-common(x86-64) = 5.3.3-38.el6
           Available: php-common-5.3.3-40.el6_6.x86_64 (updates)
               php-common(x86-64) = 5.3.3-40.el6_6
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
share|improve this question

1 Answer 1

You have to install the commandline interface version of php before you can use it from bash:

yum install php-cli

the commandline version is not necessary if PHP is part of a page in nginx.

share|improve this answer
1  
See edited post –  user3566301 Dec 8 '14 at 19:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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