This is the script to paste in cron to run a PHP file
php -f /home/username/public_html/cron-daily.php
Anyway I haven’t tried to put the script outside public_html directory. Logically PHP cannot run outside web root folder unless you set it to run outside web root folder in apache.
And you can use this script to run PHP by full URL. Even script on other server
lynx -dump http://yourdomain.com/yourscript.php >/dev/null 2>&1
This is how to do daily mysql backup with cron job in cpanel. This cron job will backup your mysql database as dump file (and gzip) daily. The files will be replaced on the same day next week.
Command to run to dump your mysql database, gzip it and replace it the following week as follow
mysqldump -uDBUSERNAME -pPASSWORD --opt DBNAME > /home/USER/dbbackup/FILENAME.sql; gzip -f /home/USER/dbbackup/FILENAME.sql
Replace DBUSERNAME, PASSWORD, DBNAME, USER, FILENAME respectively.