I have a very simply script which does nothing more than tests the connection to the database from our webserver. The script is as follows :
<?php
error_reporting(0);
$host = "host=PostgresServerName";
$port = "port=5432";
$dbname = "dbname=PostgresDBName";
$credentials = "user=postgres password=postgres";
$db = pg_connect( "$host $port $dbname $credentials" );;
if(!$db){
echo "Error : "0"; # Unable to open database
} else {
echo "1"; # Opened database successfully
}
?>
The idea it to test the connection to the database from the same server and the same connection method (PHP PDO) as my web application to ensure that connectivity method is working. The issue is that when running this the Linux Script monitor makes this a perl script which obviously will not work. If I put this script on the server and put the command line to run the script in the "Command Line" field, it executes, gives me the output I desire, but the monitor fails because it says "Script output values are not defined or improperly defined."
Does anyone have any idea how I can get this to work? I don't know how to write perl scripts, but is wrapping this into a perl script under script body possible?
Thanks in advance.