PHP CLI Not Running but Installed...Sort of

MojoCreations

Active Member
Feb 14, 2012
31
0
56
cPanel Access Level
Root Administrator
I am trying to get PHP CLI to work and it is not working for me at all. When I run sudo find I get

Code:
[~]# sudo find / -name php-cli
/home/virtfs/usrone/usr/bin/php-cli
/usr/bin/php-cli
If I go to the usr directory and edit the php-cli link it shows me, /usr/local/bin/php. Is this correct?

I run /usr/local/bin/php -v and get the following

Code:
root[~]# /usr/local/bin/php -v
PHP 5.5.17 (cli) (built: Sep 24 2014 11:53:13)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with the ionCube PHP Loader v4.6.1, Copyright (c) 2002-2014, by ionCube Ltd.
If I run sudo yum install php-cli it returns

Code:
root [~]# yum install php-cli
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrordenver.fdcservers.net
 * epel: mirror.compevo.com
 * extras: centos.escapemg.com
 * updates: centosi3.centos.org
 * webtatic: us-east.repo.webtatic.com
Setting up Install Process
No package php-cli available.
Error: Nothing to do
If I run rpm -q php-cli i get

Code:
root[~]# rpm -q php-cli
package php-cli is not installed
If I run php -a i get an Interactive Shell with a php > prompt
Code:
root[~]# php -a
Interactive shell
php >
I have a php file i am testing which results in Not Running from CLI. The php script is:
Code:
<?php
if(php_sapi_name()==="cli")
  echo("Running from CLI"); 
else
  echo("Not Running from CLI");
What am I missing here? I can't seem to figure out how to get CLI to work. Thanks for the help.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,883
2,256
463
Hello :)

You should already have it installed by default at:

/usr/bin/php-cli

Thank you.
 

MojoCreations

Active Member
Feb 14, 2012
31
0
56
cPanel Access Level
Root Administrator
Michael,

It looks like it is installed but not running or working with the script i used. Did you see the script I ran, it came back that its not working.

If I go to the usr directory and edit the php-cli link it shows me, /usr/local/bin/php. Is this correct?