PDA

View Full Version : What are Cronjob linux commands to run PHP file?



Fli
09-26-2013, 09:11 PM
Hello, on my website i uploaded .php file i want to run regularly. http://domain.com/file.php

I want to ask what are the commands to run this file in cronjob command line?

---
EDIT: i found this to be working: curl http://domain.com/file.php

IntegralHost
01-11-2015, 08:20 AM
wget -q -O - http://domain.com/file.php >/dev/null 2>&1


This too will work.

kumkum
06-08-2022, 07:48 PM
If you are using cpanel then you can easily add cron job being a beginner too.
You can add cron job in cpanel (https://hoststud.com/resources/how-to-add-a-cron-job-in-cpanel.201/) easily.

Rex_M
07-12-2022, 02:25 PM
Hello, on my website i uploaded .php file i want to run regularly. http://domain.com/file.php

I want to ask what are the commands to run this file in cronjob command line?

---
EDIT: i found this to be working: curl http://domain.com/file.php


Hello Fli,

I hope you are doing well!

The usual method for running PHP files by a cron job is to use a command-line program such as wget or curl. For example, the cron job will run a command alike the following command:

curl http://example.com/script.php

In the above command, the curl retrieves the web page, which then executes the PHP file. You can also run the PHP file directly by using the PHP command-line interpreter. This method is just as effective and usually more faster. You can run the PHP file with the below command,

php -q ${HOME}/public_html/script.php

If you have cPanel access, you can easily set up the cron job and schedule your task to run your PHP files. To run the PHP files, you must set this up using cPanel's cron jobs feature.

--------------------
Regards,
Rex_M