I have a couple command line php scripts and also php pages that call the same class file. Instead of having mutiple copies of it floating around, I want to put class.myApi.php in one central location on the filesystem. All files will then reference that one single file. Where does it belong? Does it belong in /usr/bin ?

  • Is this a per-user problem or a global one? – XQYZ May 13 '11 at 14:55
  • @XQYZ I don't understand the question. Root uses it in cron (I think) and then whatever Apache user uses it in serving pages. – user394 May 13 '11 at 14:57
  • Well if it had been a user problem then the location would be in your home. So I was just checking here. It's a difficult question, but since apache uses it anywhere but your www directory seems wrong imho. – XQYZ May 13 '11 at 15:20

I would suggest either /usr/local/share/php/your-app-name or /opt/local/share/php/your-app-name.


I think the most appropriate place would be


See the Filesystem Hierarchie Standard for more information.

  • 2
    That would be appropriate for packaged files belonging or built for the target distribution. Locally contributed files shouldn't go under /usr (outside /usr/local). – jlliagre May 13 '11 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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