westman 10 Posted April 18, 2017 Report Share Posted April 18, 2017 Hi all, I am looking for the right command to give to run a php file using a cron job. I have tried the following... /usr/local/cpanel/bin/jailshell: -c: /home/my_username/public_html/folder/file.php" /usr/local/cpanel/bin/jailshell -q /home/my_username/public_html/folder/file.php" /usr/local/bin/php -q /home/my_username/public_html/folder/file.php" /usr/bin/php -q /home/my_username/public_html/folder/file.php" and /home/my_username/public_html/folder/file.php" I get this error in an email... /usr/local/cpanel/bin/jailshell: -c: line 0: unexpected EOF while looking for matching `"' /usr/local/cpanel/bin/jailshell: -c: line 1: syntax error: unexpected end of file What command should I give to run a php file from a cron job? My linux server info: cPanel Version 64.0 (build 12) Apache Version 2.4.25 PHP Version 5.6.30 Quote Link to post Share on other sites
Don E 125 Posted April 18, 2017 Report Share Posted April 18, 2017 Are you running the first cron job with the colons? /usr/local/cpanel/bin/jailshell: -c: /home/my_username/public_html/folder/file.php" Try removing the colons and also the double quote at the ends of the cron jobs. 1 Quote Link to post Share on other sites
westman 10 Posted April 18, 2017 Author Report Share Posted April 18, 2017 thank you. now working. " was the problem Quote Link to post Share on other sites
westman 10 Posted April 23, 2017 Author Report Share Posted April 23, 2017 Last question for cron jobs. I have this cron job working fine.../usr/local/cpanel/bin/jailshell -q /home/my_username/public_html/folder/file.phpand if I go to www.mysite.com/folder/file.php the code will run. how do I only give access to this file through cron job and not give access through www.mysite.com/folder/file.php Quote Link to post Share on other sites
Don E 125 Posted April 23, 2017 Report Share Posted April 23, 2017 You can place the file.php in a directory other than the public_html directory since everything in the public_html directory is accessible by the public. For example, you can create a folder(directory) for cron job files in your home or username directory and call the file from there for the cron job: /usr/local/cpanel/bin/jailshell -q /home/my_username/cron_jobs/file.php Quote Link to post Share on other sites
westman 10 Posted April 24, 2017 Author Report Share Posted April 24, 2017 thanks Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.