MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //proc/self/root/scripts.20110531.215904.25158/makecpphp
#!/usr/bin/perl
# cpanel - makecpphp                              Copyright(c) 2010 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

BEGIN { unshift @INC, '/usr/local/cpanel'; }

use strict;
use Cpanel::SafeRun::Errors      ();
use Cpanel::FileUtils::TouchFile ();

my $test_binary       = '/var/cpanel/3rdparty/bin/php';
my $makecpphp_profile = '/var/cpanel/easy/apache/profile/makecpphp.profile.yaml';
my @easyapche_args    = (qw( --always_do_the_oldest_phps --prefer_profile_php_over_always_do_the_oldest_phps --skip-rawopts --skip-rawenv --skip-hooks --only=PHP5 --build --makecpphp --skip-cpanelsync), "--profile=$makecpphp_profile");

my $from_upcp = ( @ARGV && grep( /^--from-upcp$/, @ARGV ) ) ? 1 : 0;

if ($from_upcp) {
    unshift @easyapche_args, '--from-upcp';
}

print "Rebuilding cPanel's internal PHP installation...\n";
print "(This is *NOT* the PHP installation used with Apache)\n\n";
sleep 2;

system '/scripts/cpanel_easy_sanity_check', '--quiet'; # this should bring in $makecpphp_profile so we can hceck for it before calling easyapache (w/ skip-cpanelsync since we just did it)
die 'makecpphp profile was not found!' if !-e $makecpphp_profile;
system '/scripts/easyapache', @easyapche_args;

print "\nDone rebuilding cPanel's internal PHP.\n";

if ( !-x $test_binary && -x $test_binary . '-cgi' ) {
    $test_binary .= '-cgi';
}

if ( phptest() ) {
    Cpanel::FileUtils::TouchFile::touchfile('/var/cpanel/usecpphp');
    print "Successfully rebuilt cPanel's internal PHP: $test_binary\n";
}
else {
    unlink '/var/cpanel/usecpphp';
    die "Failed to build working PHP\n";
}

sub phptest {
    if ( -x $test_binary ) {
        print "Testing: $test_binary ";
        my $phpout = Cpanel::SafeRun::Errors::saferunallerrors( $test_binary, '-v' );
        if ( $phpout =~ m/^PHP\s+\d+\.\d+\.\d+\s+\(cgi/im ) {
            chmod 0755, $test_binary;
            print "WORKS!\n";
            return 1;
        }
        else {
            print "BROKEN\n";
            chmod 0644, $test_binary or do {
                warn "Unable to disable $test_binary: $!";
                return;
            };
        }
    }
    return;
}