LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Bash script to check ioCube and suphp is installed (http://www.linuxquestions.org/questions/programming-9/bash-script-to-check-iocube-and-suphp-is-installed-910078/)

waha87 10-25-2011 11:05 AM

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 12: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:

Code:

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

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-25-2011 11:27 PM

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:34 PM.