Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 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 ?

share|improve this question
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
up vote 2 down vote accepted

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

share|improve this answer

I think the most appropriate place would be


See the Filesystem Hierarchie Standard for more information.

share|improve this answer
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 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.