Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to move my php scripts out of the /var/www so that they are not accessible via a URL. But where is the most logical place to store these?

share|improve this question
up vote 2 down vote accepted

/var/phpscripts could fit for you. There is no default, but it's mandatory that stays outside the public folder.

share|improve this answer

Any option might be good one, i for example like the /home/%user% path, it's outside the reach of the web (depends on where i've pointed apache to look). you can also keep it on /var/www but chmod it so no one can access it outside.

share|improve this answer

I like /usr/local/[something], ie /usr/local/cron/ or /usr/local/bin/ which is what $work rolls with. Other than that using the $HOME directory of the user the script will run as is a good place to put it. $HOME/bin/ or $HOME/cron/ are solid options.

The "most logical place" is really up to you.

share|improve this answer
+1 for /usr/local/bin – Tom O'Connor Dec 27 '12 at 23:05
@TomO'Connor if only there were a place for a us e r to put their local scripts and bin aries... – Sammitch Dec 27 '12 at 23:11

I prefer using a bin directory under the $HOME directory of the user invoking the cron job. If you're invoking as the httpd user, you could still do that, but add an .htaccess file to the bin directory to prevent access via the web server.

share|improve this answer

Another option is /opt/$application/bin, which is mostly inkeeping with FHS, but really my heart is with /usr/local/bin.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.