Cron job working via cpanel
How to run the php file from cron job via cpanel?
Here it is:
1. login to your cpanel
2. click cron icon
3. click standar
4. enter your email address for reporting if the cron is failed
5. choose the time what you want
6. enter the command, it depends on your server hosting.
the command should be like this:
curl -s -o /dev/null http://yourdomain.com/your_script.php
if curl is disable form your hosting service, you can use another way, with this:
lynx -dump http://yourdomain.com/your_script.php > /dev /null
if curl and lynx is disable form your hosting service, you can use another way, with this:
/usr/bin/wget -O - /home/your_username/public_html/script.php
or
GET http://yourdomain.com/your_script.php > /dev /null
if curl, lynx and wget is disable form your hosting service, you can use another way, with this:
in the your_script.php file put this at the top the first line before anything:
!#/usr/bin/php
and use this cron command
php -f /home/your_username/public_html/your_script.php
note:
file your_script.php should chmod 755
and the /home/your_username/ is your path on server.
if you have still problem, like " No input file specified. ", please try this:
links http://yourdomain.com/your_script.php
7. save it
done...
if you have error, pls let me know, welcome to leave comment here..
2 comments:
Great post!!
It works for me now!
Thanks alot...
This will also work
/usr/bin/php -f public_html/your_script.php
Post a Comment