0

The folder structure is like this:-

public_html
     |
     |_ disability.com
           |
           |_ cron_birthday.php

Under public_html, there is a folder called disability.com which has the php file.

In the CPanel's Cron Jobs Management, I created a cron job in this way:-

0 0 * * * /usr/local/bin/php -q /home/the_usr_name/public_html/disability.com/cron_birthday.php

The cron job is intended to fire the php script everyday at 12.00 AM.

However, the script isn't fired at all. But when I am hitting the phpfile in the browser by typing the corresponding url, the script exactly does the work it is expected to do. That means, the script is working fine.

Why isn't the cron job running? How can I solve it?

Note:

I even tried the following cron job to run the script in every minute.

0 0 * * * /usr/local/bin/php -q /home/the_usr_name/public_html/disability.com/cron_birthday.php

Still, the cron isn't firing.

Saswat
  • 12,320
  • 16
  • 77
  • 156
  • A problem I had was I was trying to run the cron job as "randomSystemUser", however the script owner was "randomSystemAdmin". Can you check that, because your cron job syntax is right. – thefolenangel Apr 04 '18 at 11:09
  • Can you explain what you mean by **randomSystemUser** and **randomSystemAdmin**? I am not aware of these things. – Saswat Apr 04 '18 at 11:19
  • Two solutions you can try: First use wget command, so your command would look something like this: wget -q -O/dev/null http://www.disability.com/cron_birthday.php The other thing you can do is specify the user for the cron, like done here : https://stackoverflow.com/questions/8475694/how-to-specify-in-crontab-by-what-user-to-run-script where the user should the user you log with in your Cpanel. – thefolenangel Apr 05 '18 at 06:53

0 Answers0