-   Programming (
-   -   Bash script to check ioCube and suphp is installed (

waha87 10-25-2011 12:05 PM

Bash script to check ioCube and suphp is installed
Hi Friends

Kindly help me write a bash script to check ioncube loader is installed and also the suphp is enabled. I know "Php -v" will show the details of the ioncube loader and also i can get suphp information from "/usr/local/apache/conf/php.conf. But i don't know how to check it using a script. So if someone could some light on how to get do this.

Server: CentOS 5.6 with cpanel

MensaWater 10-25-2011 01:20 PM

Scripting is fairly simple if you already know the command line and output.

So tell us exactly what you type to check it manually and what you see when you type that and it should be simple for us to tell you what should be in your script.

For example if you type "php -v" and it outputs something like:
PHP 5.1.6 (cli) (built: Apr 7 2009 08:00:04)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

And you wanted to find whether it had Zend your script could be as simple as:


if php -v |grep Zend
then echo Zend is installed
else echo Zend is NOT installed

The above simply checks to see if Zend appears in the output of php -v. If it does then it prints a message saying it is installed. Otherwise it prints a message saying it is not installed.

waha87 10-26-2011 12:27 AM

Thank you MensaWater.

This is all i wanted. I didn't know that i can directly use " if" close like this. You really helped me. Now i know how to proceed.

Thanks again.

All times are GMT -5. The time now is 06:27 AM.