Take the 2-minute tour ×

i would like some explanations.

i have a script

//mailing script here

i have add the CRON job from my cpanel for every day.

  1. i was getting : Permission denied (then i added "wget http://domain.com/performance_cron/daily.php > /dev/null" before the php tags and it is working). is that the best solution?
  2. the jobs are being saved in my root directory "/" before public HTML. is this a good thing? or i how can i change the saving directory?
  3. finally i am getting "2: Syntax error: "(" unexpected" though the job is being done.


share|improve this question
accept some answers –  k102 Feb 1 '12 at 7:19
add comment

closed as not a real question by Brian Roach, sarnold, Book Of Zeus, outis, animuson Mar 31 '12 at 6:53


2 Answers

up vote 0 down vote accepted
  1. If you dont have PHP installed as CGI then you need to use wget path/to/php > /dev/null
    if PHP installed as CGI try adding #!/usr/local/bin/php as a first line in php script, befor starting <?php tag. ("#!/usr/local/bin/php" = path to php executable)
  2. it is good idea to protect cron scripts and put them outside public access
  3. "(" unexpected" is a error in php code, try to resolve it.
share|improve this answer
add comment
  1. Wget is a good way to call your webdir scripts.
  2. If stored outside the webdir you can turn your php script into a stand alone php-cli script instead. Make the stand alone script executable using chmod or call a regular script through the php binary.
  3. You would have to leave more info on that one. Follow the error hints.
share|improve this answer
thanks you a lot –  user723335 Feb 1 '12 at 8:16
add comment
