westman Posted April 18, 2017 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 Link to comment Share on other sites More sharing options...
Don E Posted April 18, 2017 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 Link to comment Share on other sites More sharing options...
westman Posted April 18, 2017 Author Share Posted April 18, 2017 thank you. now working. " was the problem Link to comment Share on other sites More sharing options...
westman Posted April 23, 2017 Author 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 Link to comment Share on other sites More sharing options...
Don E Posted April 23, 2017 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 Link to comment Share on other sites More sharing options...
westman Posted April 24, 2017 Author Share Posted April 24, 2017 thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now