Jump to content

Archived

This topic is now archived and is closed to further replies.

referlive

PHP and Cronjobs

Recommended Posts

Hello,

 

My website runs on a dedicated Linux server. I\'m trying to run a cronjob that will run a script called \"followup.php\".

 

So, the full URL of this script is

http://www.mydomain.com/followup.php

 

And the path to this script is

/home/admin/mydomain.com/htdocs/followup.php

 

The only control panel I got is Webmin.

 

When I first tried to schedule this cronjob, I got an error saying \"Permission\" denied.

 

I went and changed the CHMOD for the file in question to 777. Now when I run it,

 

it gives me strange error message, which include the first few lines of code in that script.

 

What am I doing wrong? If you could answer me, I would be forever grateful!

 

PS: I tried this through SSH, but I still got an error message!

 

Thank you so much,

 

Jimmy

Share this post


Link to post
Share on other sites

can you provide more specifics, i.e.: the error message, the code?

Share this post


Link to post
Share on other sites

the permissions on your php file do not need to be no more than 0644 and to have cron execute a php script you need to tell the system what type of file its gonna be executing. In your case this is what you would enter into the command box for cron in webmin:

 

php /home/admin/mydomain.com/htdocs/followup.php

 

then set your times to run the cronjob in your selection boxes below it and save it. Also dont forget at the top of your cronjob setup page in webmin is the box that you tell cron what user is executing it,It must be a user with access to run cron jobs.

 

Hope that helps

Share this post


Link to post
Share on other sites

have you tried doing crontab -e within ssh to see if you have access to crontab? if not, you might have to add yourself to the allowed crontab users

 

Kosta

Share this post


Link to post
Share on other sites

I did what Nick suggested. I put \"php\" before the full path of my file. It worked :)

 

Thank you all for your help!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.