Jump to content

Cron Job security, CHMOD


bambinou1980

Recommended Posts

Hello,

 

I would like to setup a cron job in my cpanel. This cron job is situated in:

public_html/protected/commands/cron.php

 

I do not want people to call this url from the web as it could hit the server ressources if started too often.

 

Is there a way to set this cronjob in a way that it is only executable from the server itself and not from the web. Please tell me if I am wrong but what I did is set up the command as:

 

/usr/bin/php -q /home/account_name/public_html/protected/commands/cron.php

 

And set the cronjob.php file to 644.

 

Is this right?

 

Thank you.

 

Ben

Link to comment
Share on other sites

If you do not want visitors to your site accessing cron.php then do not store in your public_html folder (aka your document root). Store it outside of the document root. 

 

 

I see people adding -q or -php front of the path, what does this changes please, any idea?

It doesn't change anything it is telling the server which program to execute, and passing command line option -q to PHP and stating the path the php file to be executed

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.