Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

5 Answers 5

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
add comment

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
add comment

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
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.