Centos + CPanel results in php always running as fgci, instead of cli, as expected

Posted by quamis on Server Fault See other posts from Server Fault or by quamis
Published on 2013-10-31T07:47:00Z Indexed on 2013/10/31 9:56 UTC
Read the original article Hit count: 251

Filed under:
|
|
|

I'm having problems with a server configured by someone else. It uses CPanel, and it has Apache+PHP.

For some reason, when running php -v as a user, i get "cli" as handler

# php -v | head -n 1
PHP 5.3.27 (cli) (built: Oct 15 2013 16:06:48)

If a make a PHP script with echo shell_exec("php -v | tail -n 1"), i get

PHP 5.3.27 (cgi-fcgi) (built: Oct 15 2013 16:22:16)

Why the cli/fcgi difference? I need to fix this so that scripts ran by the apache user would be running as "cli", not "fcgi".

As a side-note, i'm not sure how php got installed, because in the package list i see another version installed, instead of the pne reported by php -v

# rpm -qa | grep php
[.... other packages...]
cpanel-php53-5.3.17-5.cp1136.x86_64

rebuild_phpconf --current:

/usr/local/cpanel/bin/rebuild_phpconf --current
Available handlers: suphp dso fcgi cgi none
DEFAULT PHP: 5
PHP4 SAPI: none
PHP5 SAPI: dso
SUEXEC: enabled
RUID2: not installed

redhat-release:

# cat /etc/redhat-release
CentOS release 6.4 (Final)

possibly related to http://superuser.com/questions/665809/centos-6-4-running-php-for-root-as-cgi-fcgi-not-cli

© Server Fault or respective owner

Related posts about apache2

Related posts about centos