Mobile app version of vmapp.org
Login or Join
Chiappetta492

: Safe directory for cron job PHP scripts I have a website which I run a PHP script for updating its Database. What is considered to be an acceptable location on the server to store such scripts?

@Chiappetta492

Posted in: #Linux #Php

I have a website which I run a PHP script for updating its Database.
What is considered to be an acceptable location on the server to store such scripts? Obviously only the root (running a cronjob to start the script) should have access to it.

Thanks,

Joel

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Chiappetta492

1 Comments

Sorted by latest first Latest Oldest Best

 

@Murray155

If you are worried about access to this script you can add a random string to the command line argument of the cron job string e.g.

php /path/to/script.php random_string


Then in your script.php you check argv0 to see if that string is exists and is correct before running the rest of your code.

Another way is to put the cron script in a folder and restrict its access using a .htaccess file. Here is an answer on how to do this: serverfault.com/questions/92192/apache-htaccess-file-to-restrict-access-to-all-files-unless-local-ip

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme