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 am sorry to be asking for help when there's loads of that on the internet, however I'm not Linux savvy.


I've installed apache2 and PHP5 under debian, and uses of PHP fopen() function produce typical:

Warning: fopen(/some/where/some.txt): failed to open stream: Permission denied in /some/file/location/of/script/index.php on some line

Hoped response:

I would be very grateful if anyone could kindly supply me with a secure/minimum required solution to make it work, and even better if that would be explained as well.

Weak assumption:

It is extremely likely that some folders or configurations require correct permissions set, however I am in a dark forest when it comes to that.


  • Apache is compiled and installed from source. PHP is compiled and
  • installed from source, without default php.ini
  • Above should be considered with me not being Linux savvy and not getting permissions.
share|improve this question

It's likely to be nothing to do with your Apache/PHP setup however you've provided no information about how these are configured. Most likely the user the PHP script is running a does not have permission to open the files. Without knowing how it's configured I can't tell you how to get this information (ps auxwww | grep php might show the user). Nor have you told us what the permissions / ownership on the files are (chmod a+wr filename.txt makes a filereadable/writeable by any user - but that seriously compromises security).

How you make your files accessible and secure depends on your security policy but knowing nothing about the machine / it's purpose nor how it is configured would make it impossible even with your security policy.

A further consideration is that storing data in flat files, accessed directly via PHP is almost always a very bad idea. It does not scale and can lead to deadlocks and race conditions.

share|improve this answer
If you want the machine to be secure then you need the skills to manage / configure it. – symcbean Jan 28 '13 at 9:29

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.