I’m encountering an issue with the execution of a cron job, specifically within cPanel’s cron job setup. When I run the following command with root access in the command line, everything works perfectly, and there are no issues:
/opt/cpanel/ea-php73/root/usr/bin/php -q /home/username1/crmfile/crons/cron.php all -F -vvv >> /home/username1/crondebug.txt
However, when I precisely set the same command in the cPanel cron job setup with the user “username1,” I get the following error in the crondebug.txt file:
<div class="error-container"><h1>Critical Error</h1><p>Could not connect to the database.</p></div>
This title includes additional information to clarify that the website is accessible and functioning correctly, and you have already performed troubleshooting and diagnostics related to WHMCS settings without finding any issues.
But this is not working only in cpanel cron job.
How can I resolve this issue?