Introduction
You may use the following information to troubleshoot problems with cronjobs run by cPanel users.
When running scripts on the command line, *DO NOT* use the root user to execute those scripts. Executing scripts via the command line introduces your server to serious security vulnerabilities. If a user-level compromise has occurred on the account containing the script, and the script you run as the root user has been modified, you would give the attacker full root access to do whatever they want with your server.
Procedure
- Access the server's command line as the cPanel user via SSH or "Terminal" in cPanel.
- Edit the user's cron jobs.
crontab -e
- Ensure that the full path is used for the binary and the script to run.
* * * * * /usr/local/bin/php /home/cpanelusername/public_html/path/to/script/example.php
- Save changes and exit crontab.
- Run the cron job's command.
/usr/local/bin/php /home/cpanelusername/public_html/path/to/script/example.php
- Correct any errors returned.
- Repeat the previous two steps until no errors are returned.
Comments
0 comments
Article is closed for comments.