Cronjobs Syntax error - need Advise

GuiPos

Well-Known Member
Jul 9, 2003
59
0
156
Indonesia / Germany
Hello Forum Member

i have a php script which should running every 15 min as a cron job

its located in /home/*****/public_html/*****/*****/serv_cron.php

if i put in the cpanel cronjob manager only the path to this
file i get follow error message:

/home/****/public_html/****/*****/serv_cron.php: ?
: No such file or directory
/home/****/public_html/****/*****/serv_cron.php: line 2: syntax error near unexpected token `include("../config.php")'
/home/****/public_html/****/*****/serv_cron.php: line 2: `include("../config.php"); '

can someone please hlp me to bring light in this problem or to point me in the right direction ?
What i have to type in in the cronjob manager ?

Thank you for your help!

cPanel.net Support Ticket Number:
 

Jemshi

Well-Known Member
Sep 11, 2003
208
0
166
India
I think you have missed the /usr/bin/php (interpreter).

crontab -l from your login should show something like this.

* * * * * /usr/bin/php _full_path_to_script

thats all.

cPanel.net Support Ticket Number:
 

GuiPos

Well-Known Member
Jul 9, 2003
59
0
156
Indonesia / Germany
Originally posted by Jemshi
I think you have missed the /usr/bin/php (interpreter).

crontab -l from your login should show something like this.

* * * * * /usr/bin/php _full_path_to_script

thats all.

cPanel.net Support Ticket Number:
Thank you for your fast answer and your help.

the problem for me is:

i dont have shell or telnet access - so i can only setup the crontab via Cpanel - Crontabs

and i have no glue how to write this syntax
:confused:

Thank you

cPanel.net Support Ticket Number:
 

Jemshi

Well-Known Member
Sep 11, 2003
208
0
166
India
okay, then add this much from your control panel.

/usr/bin/php _full_path_to_script

and of course, your times also :)

cPanel.net Support Ticket Number:
 

GuiPos

Well-Known Member
Jul 9, 2003
59
0
156
Indonesia / Germany
Originally posted by Jemshi
okay, then add this much from your control panel.

/usr/bin/php _full_path_to_script

and of course, your times also :)

cPanel.net Support Ticket Number:
Hello jemshi

Thanx for the fast answer
asume the script is located in a subrot folder like this:

/home/*****/public_html/3/0815/stat_cron.php

should i type in the path ( syntax ) like this

sh /home/*****/public_html/3/0815/stat_cron.php

or the syntax you type in this thread:

/usr/bin/php /home/*****/public_html/3/0815/stat_cron.php

i am a newbie in cpanel so please excuse me if i clarify or ask again

Thank you
Guido

cPanel.net Support Ticket Number:
 

Jemshi

Well-Known Member
Sep 11, 2003
208
0
166
India
Originally posted by GuiPos
Hello jemshi

Thanx for the fast answer
asume the script is located in a subrot folder like this:

/home/*****/public_html/3/0815/stat_cron.php

should i type in the path ( syntax ) like this

sh /home/*****/public_html/3/0815/stat_cron.php

or the syntax you type in this thread:

/usr/bin/php /home/*****/public_html/3/0815/stat_cron.php

i am a newbie in cpanel so please excuse me if i clarify or ask again

Thank you
Guido

cPanel.net Support Ticket Number:
dont use the sh line.. this means that you are asking the shell to execute php - this is not right.
use the following line.

/usr/bin/php /home/*****/public_html/3/0815/stat_cron.php

cPanel.net Support Ticket Number:
 

GuiPos

Well-Known Member
Jul 9, 2003
59
0
156
Indonesia / Germany
Originally posted by Jemshi
dont use the sh line.. this means that you are asking the shell to execute php - this is not right.
use the following line.

/usr/bin/php /home/*****/public_html/3/0815/stat_cron.php

cPanel.net Support Ticket Number:
its seems to work
i got a email :

Failed loading /usr/local/Zend/lib/ZendOptimizer.so: /usr/local/Zend/lib/ZendOptimizer.so: undefined symbol: zend_execute_internal
X-Powered-By: PHP/4.1.2
Content-type: text/html

i think now the only issue is that the zend optimizer isn't working

thankyou

cPanel.net Support Ticket Number:
 

Website Rob

Well-Known Member
Mar 23, 2002
1,501
1
318
Alberta, Canada
cPanel Access Level
Root Administrator
Originally posted by GuiPos
Hello Forum Member

i have a php script which should running every 15 min as a cron job

its located in /home/*****/public_html/*****/*****/serv_cron.php

What i have to type in in the cronjob manager ?
*/15 * * * * GET http://yourdomain.com/path/to/cron_script.php > /dev/null

This should get that script every 15 minutes, but will not send you an email every 15 minutes telling you it finished (that would be horrible), that is were the /dev/null comes into play.

Or so I'm told anyway. :)
Never tried it myself so would be interested in your feedback.

cPanel.net Support Ticket Number:
 

GuiPos

Well-Known Member
Jul 9, 2003
59
0
156
Indonesia / Germany
Re: Re: Cronjobs Syntax error - need Advise

Originally posted by Website Rob
*/15 * * * * GET http://yourdomain.com/path/to/cron_script.php > /dev/null

This should get that script every 15 minutes, but will not send you an email every 15 minutes telling you it finished (that would be horrible), that is were the /dev/null comes into play.

Or so I'm told anyway. :)
Never tried it myself so would be interested in your feedback.

cPanel.net Support Ticket Number:
Thank you - Website Rob

But the problem - i have no shell or telnet access
i can only configure this via cpanel - cronjobs

and run in some small probs. :confused:

cPanel.net Support Ticket Number:
 

Website Rob

Well-Known Member
Mar 23, 2002
1,501
1
318
Alberta, Canada
cPanel Access Level
Root Administrator
Use 'Advanced' instead of Standard within Cpanel-Cron jobs.

cPanel.net Support Ticket Number:
 

GuiPos

Well-Known Member
Jul 9, 2003
59
0
156
Indonesia / Germany
Re: Re: Cronjobs Syntax error - need Advise

Originally posted by Website Rob
*/15 * * * * GET http://yourdomain.com/path/to/cron_script.php > /dev/null

This should get that script every 15 minutes, but will not send you an email every 15 minutes telling you it finished (that would be horrible), that is were the /dev/null comes into play.

Or so I'm told anyway. :)
Never tried it myself so would be interested in your feedback.

cPanel.net Support Ticket Number:
i think its work fine
but if i dont write the email address in the header of the crontabs - cpanel then is this the same solutions ?

Thank you very much

cPanel.net Support Ticket Number:
 

Website Rob

Well-Known Member
Mar 23, 2002
1,501
1
318
Alberta, Canada
cPanel Access Level
Root Administrator
Not sure what you mean?

If you do want eMails then leave off: > /dev/null

BTW, why do you quote every post?

cPanel.net Support Ticket Number:
 

Website Rob

Well-Known Member
Mar 23, 2002
1,501
1
318
Alberta, Canada
cPanel Access Level
Root Administrator
That's where your own testing comes in. :D

cPanel.net Support Ticket Number: