How to configuration cron job in cpanel

久未见 提交于 2019-12-14 03:15:20

问题


How to configuration Cron Job in cPanel for .PHP script.

I want to run it every day once a day.

Where i need to store this .php file ?

How can i check whether its working or not ?


回答1:


You may put the file.php file in the "public_html" folder in your server. You have the option of cron job in the cpanel "Advanced" section. Once you're there you have the option to add a new cron job and "common setting" called "Once a day", which will satisfy your need. In the "command" field paste this: wget --spider http://yoursite.com/file.php and then save.

Of course this is not the best practice, but I hope it will do the job for you.




回答2:


You can do it through command but since you using cPanel, use the interface:

Then fill out Add New Cron Job

For example, a cron for a php script that runs everyday at midnight sharp would look like this

Minute  Hour    Day   Month    Weekday  

0        0        *     *         *     php /path/to/script.php



回答3:


  1. Click on the "Cron Jobs" icon inside cPanel, under Advanced.
  2. Make sure the current email address is valid. If not, enter a new email and click the "Update Email" button.
  3. Select the Common Setting you want. This will automatically change the other time settings.
  4. Alternatively, you may adjust the individual time settings. Minute, Hour, Day, Month and Weekday can be modified to achieve your goal.
  5. In the input box to the right of "Command", type the name of the file type, then add a space and provide the path to the file which you would like the command to run.

Click the "Add New Cron Job" button.

Link :

Here Link



来源:https://stackoverflow.com/questions/30872747/how-to-configuration-cron-job-in-cpanel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!