Commercial Support Clients: Clients with support contracts can get escalated support assistance by visiting Nagios Answer Hub. These forums are for community support services. Although we at Nagios try our best to help out on the forums here, we always give priority support to our support clients.

PHP sybase_connect from nagios script

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.

PHP sybase_connect from nagios script

Postby WilnarMasonik » Mon Sep 12, 2022 6:09 am

Has anyone had problems connecting to a sybase database using sybase_connect in PHP running as a nagios plugin?

My script runs perfectly under the same nagios user on the command line but if I run it via nagios it can never connect to the database, sybase_connect always returns a false connector and sybase_get_last_message is empty.

I've checked the environment settings and even though I'm doing, putenv the only thing I can see is the SYBASE variable may not be set

putenv ("SYBPLATFORM=linux");
putenv ("LC_ALL=default");
putenv ("DSQUERY=SYBASE");
putenv ("SYBASE=/usr/local/freetds");
putenv ("LD_LIBRARY_PATH=/usr/local/freetds/lib");
putenv ('PATH=/usr/local/freetds/bin'); // With this on or off makes no difference

$connector = sybase_connect ( "HOST-IN-FREETDS", "USER", "PASSWORD" );
if ($connector === false) {
// Always falls into here if run via nagios, works if run as the same user from the command line
I've compared the settings by running:

$return = `set`;
trigger_error ($return, E_USER_NOTICE);
And checked the php error log, I've also pushed phpinfo to a file and done a diff when running it manually and via nagios.

Environment - Ubuntu LTS 14.04, Nagios echatspin echatrandom Core 4.0

Any ideas anyone? Thanks in advance
Posts: 4
Joined: Mon Jul 18, 2022 1:46 am

Return to Open Source Nagios Projects

Who is online

Users browsing this forum: No registered users and 21 guests