Is there some trick to getting mysql working in a cron job?
I’ve got a PHP function that works fine when called by the web server, but it fails when cron calls it.
The function first tests for the mysqli_connect function:
$si = function_exists(‘mysqli_connect’);
echo “Whoops! MySQLi does not appear to be compiled or enabled properly!”;
Here’s what cron mails to me (personal info removed):
Whoops! MySQLi does not appear to be compiled or enabled properly!
Fatal error: Call to undefined function: mysqli_commit() in /home/XXXX/XXXX/includes/DBUtils.php on line 689
The call to mysqli_commit obviously comes later in the file.
I read somewhere that cron doesn’t have environment variables available to it. Could that be the problem?
How can I fix this?