flyclassic flyclassic - 1 year ago 67
PHP Question

Run a script.php on cron job on linux/apache server but restrict public access to the php file

I have this script.php file which i want to run as a cron job on my linux/apache server.

However, i do not want public to access and also run the script concurrently.

How can we prevent that? How can we restrict the script to the server's access only?
Is it using chmod or setting something inside .htaccess file, something along the line?

Any advice ?

Answer Source

You probably have something like a public_html directory, in which you have all the phps. Just put it outside of that directory.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download