#!/bin/sh
eval 'if [ -x /usr/local/cpanel/3rdparty/bin/perl ]; then exec /usr/local/cpanel/3rdparty/bin/perl -x -- $0 ${1+"$@"}; else exec /usr/bin/perl -x $0 ${1+"$@"}; fi;'
  if 0;

#!/usr/bin/perl
#
# cpanel - cpanel-status                          Copyright(c) 2013 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
#
#
# Determine whether or not Zend Opt is installed

my $prefix = '/usr/local';
if (@ARGV) {
    $prefix = shift;
    $prefix =~ s/\/$//;
}

my $php_ini = $prefix . '/lib/php.ini';
if ( $prefix eq '/usr/local/cpanel/3rdparty' || $prefix eq '/var/cpanel/3rdparty' ) {
    $php_ini = '/usr/local/cpanel/3rdparty/etc/php.ini';
}
if ( -e $php_ini ) {
    local $/ = undef;
    open $ini_fh, '<', $php_ini || die "Could not open ${php_ini}: $!";
    my $ini_text = readline($ini_fh);
    close $ini_fh;
    if ( $ini_text =~ m{^\s*zend_extension(_ts)?\s*=\s*"?\S+Zend(ExtensionManager|Optimizer|GuardLoader)(_TS)?\.so"?\s*$}im ) {
        print "Zend Optimizer/Guard Loader extension is installed\n";
        exit 0;
    }
    print "Zend Optimizer/Guard Loarder extension is NOT installed\n";
    exit 1;
}

print "Could not locate ${php_ini}\n";
exit 2;
