Hi!
my cronjob run but give an error in my php file like that
/home/contacse/public_html/cronjob.php: line 1: ?php: No such file or directory
/home/contacse/public_html/cronjob.php: line 3: syntax error near unexpected token
`'localhost','contacse_project','
/home/contacse/public_html/cronjob.php: line 3: `mysql_connect
('localhost','contacse_project','
If I execute this file myself then this is ok but when cronjob execute this file then give above errors.
Please help me that what is the solution for this.
Thanking you
Help To Run CronJob
Moderator: General Moderators
-
shafiq2626
- Forum Commoner
- Posts: 88
- Joined: Wed Mar 04, 2009 1:54 am
- Location: Lahore
- Contact:
-
shafiq2626
- Forum Commoner
- Posts: 88
- Joined: Wed Mar 04, 2009 1:54 am
- Location: Lahore
- Contact:
Re: Help To Run CronJob
This is Solved to adding following lines.
add php -f / before your path of your file this will be written like this
php -f /home/contacse/public_html/cronjob.php
contacse this is username your user name will be different.
and also add this line before <?php in your cronjob file.
this will be like this.
Now
Be Happy with this code
add php -f / before your path of your file this will be written like this
php -f /home/contacse/public_html/cronjob.php
contacse this is username your user name will be different.
and also add this line before <?php in your cronjob file.
this will be like this.
Code: Select all
#!/usr/bin/php
<?php
//your code
?>Be Happy with this code
-
bestcanyonlakehomes
- Forum Newbie
- Posts: 1
- Joined: Mon Jan 11, 2010 8:40 am
Re: Help To Run CronJob
thanks shafiq!