PHP 5.4 Issues with choosing PHP Handler

n0nag0n

Member
Oct 18, 2013
5
0
1
cPanel Access Level
Website Owner
Long story made very short, I want to enable PHP APC caching on our server. I have it up and working, kinda. Right now suPHP is the PHP handler and I need to change it to DSO so that APC will actually persist the data that is being store (as it doesn't play nicely with really anything but DSO). I've hit a big road block and I can't choose a PHP handler. When I go to the Configure PHP and suEXEC screen it shows me my current setup, but the drop downs are empty/say "none".

I've tried running easyapache probably 6-7 times and after an error with compiling 3-4 of those times, I finally got it to compile correctly and now it's being awesome (/etc/hosts had a weird entry for 127.0.0.1 giving a mirror error at the end)

I increased the Max Cpanel Process Memory.....setting in "Tweak Settings" to unlimited, ran /etc/init.d/cpanel restart, rebuilt using easyapache, still no dice. I don't think suhosin is installed, but I haven't figured out how to check? It's not an option when using the exhaustive list in easyapache.

I've been googling for a few hours this morning and haven't found a solution that works for me. Here's some output to chew on.

Current PHP Handler using /usr/local/cpanel/bin/rebuild_phpconf --current
Code:
Available handlers: suphp dso cgi none
DEFAULT PHP: 5
PHP4 SAPI: none
PHP5 SAPI: suphp
SUEXEC: enabled
RUID2: not installed
What happens when I try to switch to DSO using /usr/local/cpanel/bin/rebuild_phpconf 5 none dso 1
Code:
Invalid combination.
PHP5 is not available.  Please rebuild apache if you require this configuration.
The error that gets logged after trying to switch it in command line at /usr/local/cpanel/logs/error_log
Code:
Building global cache for cpanel...Done
[2013-10-18 11:06:44 -0600] warn [Cpanel::PHPINI] Unexpected output from /usr/bin/php -v :  at /usr/local/cpanel/Cpanel/PHPINI.pm line 73
        Cpanel::PHPINI::check_installed_php_binaries() called at /usr/local/cpanel/Cpanel/PHPConfig.pm line 489
        Cpanel::PHPConfig::_get_partial_advconfig_conf() called at /usr/local/cpanel/Cpanel/PHPConfig.pm line 169
        Cpanel::PHPConfig::configure_php(HASH(0xbffdc0)) called at /usr/local/cpanel/bin/rebuild_phpconf line 64
This is line 65 of PHPINI.pm which is the output from /usr/bin/php -v
Code:
my $phpout = Cpanel::SafeRun::Errors::saferunallerrors( $installed_phps->{$phpinstall}{'path'}, '-v' );
It fails this regex and returns the top error from the error_log file (line 73)
Code:
if ( $phpout =~ m/^PHP\s+(\d+\.\d+\.\d+)\s+\(([^\)]+)\)/m ) {
Output when I run /usr/bin/php -v myself
Code:
PHP 5.4.20 (cgi-fcgi) (built: Oct 18 2013 10:47:57)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
At a loss at this point. Any ideas?
 

n0nag0n

Member
Oct 18, 2013
5
0
1
cPanel Access Level
Website Owner
One other thing, if I run php -v or /usr/local/bin/php -v I get the following. I know that my php install is running off of /usr/local/lib/php.ini so could this be the problem (mixing up php installs)?
Code:
PHP 5.4.20 (cli) (built: Oct 18 2013 10:47:55) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
 

n0nag0n

Member
Oct 18, 2013
5
0
1
cPanel Access Level
Website Owner
And one last thing (can't seem to find the edit button), when I run in php the following, it outputs cgi-fcgi
PHP:
<?php
    echo php_sapi_name();
?>
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello :)

Try checking to see if you have an invalid entry in your /usr/local/lib/php.ini file. You can do this by backing up the php.ini file and regenerating it via:

Code:
mv /usr/local/lib/php.ini /usr/local/lib/php.ini.backup
/scripts/phpini
Then, check to see if you can alter the PHP handler. If you can, try adding back in any custom entries to the php.ini by comparing it to the backed up version, and then run EasyApache again to ensure your modules are properly added to the PHP configuration file.

Thank you.
 

n0nag0n

Member
Oct 18, 2013
5
0
1
cPanel Access Level
Website Owner
That actually worked generating a new php.ini file. I found that the extension that caused it to break was the APC extension. The extension itself installs correctly with no error, and it actually works, however when it's enabled it breaks the functionality of the Configure PHP and suEXEC area. I installed APC by using Software -> Module Installers -> PHP Pecl -> and then I installed APC from there. How should I go about this so that I can have APC installed and have the functionality be DSO? Should I take out the extension line in php.ini, then change it to DSO, then add the extension line back in and say a prayer?
 

n0nag0n

Member
Oct 18, 2013
5
0
1
cPanel Access Level
Website Owner
Well I went ahead and did it, and now it is working. I had to also add
Code:
AddHandler application/x-httpd-php .php .htm .html
to my root .htaccess file as all my php files wanted to download themselves :) Thanks for your help. Hopefully this helps someone in the future.