Cron Job issue: PHP Fatal error: Call to undefined function mysqli_connect()
I think this problem started just after I upgraded from EA3 to EA4, but can't be sure.
My error_log shows this error:
PHP Fatal error: Call to undefined function mysqli_connect() in...
and
PHP Fatal error: Call to undefined function mysql_connect() in...
These errors are generated by 2 different cron jobs that I set on my cpanel account long ago and were working fine for years:
First cron:
and a similar one in the same directory. I logged in to shell as root (it's a dedicated centos 6.9 server with WHM 66.0.23), and ran the same command as the command written in the cron:
php /home/XXXXX/public_html/admin/YYYYY.php >/dev/null 2>&1
and a similar one in the same directory. I logged in to shell as root (it's a dedicated centos 6.9 server with WHM 66.0.23), and ran the same command as the command written in the cron:
root@host [/]# php /home/XXXXX/public_html/admin/YYYYY.php-
ok, I did a bit more investigation and found out the cron is loading this configuration file: /home/XXXXX/php.ini
Instead of the configuration file Apache and litespeed are using:/opt/cpanel/ea-php56/root/etc/php.ini
Why does that happen and how can I fix it?0 -
I might be wrong but it seems like some kind of a bug. There was a php.ini file in my user directory, as stated above, so cron was using it. I disabled the file by renaming it to /home/XXXXX/php.ini.bak Now everything works fine. 0 -
I might be wrong but it seems like some kind of a bug. There was a php.ini file in my user directory, as stated above, so cron was using it. I disabled the file by renaming it to /home/XXXXX/php.ini.bak Now everything works fine.
Hello, It's possible you are noticing this issue due to a change in how php.ini files are managed. This is discussed in more detail on the following threads: SOLVED - cPanel 66 Update MultiPHP INI Editor Changes php.ini changes in cPanel 66 Additionally, here's an example of how to use PHP in cron job commands: PHP command examples: General example: /usr/local/bin/php /home/username/public_html/path/to/cron/script Domain-specific example: /usr/local/bin/ea-php56 /home/username/domain_path/path/to/cron/script
Thank you.0
Please sign in to leave a comment.
Comments
3 comments