You may use the following procedure to troubleshoot problems with cronjobs run by cPanel users.
First login to SSH or Terminal as the cPanel user. If you are the root user, you can use the following command. The -l flag is very important because it recreates the user's environment:
su -l cpanelusername
It is possible that you may see the following error when attempting to switch to the cPanel user:
Shell access is not enabled on your account!
If you need shell access please contact support.
A user can still make use of crons even with SSH access disabled. You can bypass this error by manually specifying the shell to use:
su -l -s /usr/local/cpanel/bin/jailshell cpanelusername
Once you have logged in as the cPanel user, you may list the existing crons with the following command:
To reproduce the error, run the command that you find in the crontab.
Failed opening required '../../example.php' errors
Some scripts make use of relative paths. Those relative paths are based on the current working directory. In order to resolve issues with resolving the location of relative paths you must use the cd command to update the current working directory to that of the script that you are running in the cron. For example:
* * * * * cd /path/to/script; php /path/to/script/example.php
If you get permissions errors when running the cron command, check the permissions with the stat command and verify that they are correct:
If you are running a bare script name like the following:
Be sure that the script is marked executable with the chmod command:
chmod +x /home/cpaneluser/path/to/script.php
Otherwise, you could instead just use the appropriate binary command in front of the cron to avoid the Permissions Error:
Another potential issue is the script might not be owned by your cPanel user. Use the chown command to fix the ownership:
chown cpaneluser:cpaneluser /home/cpaneluser/path/to/script.php