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.

Intro:

I am sorry to be asking for help when there's loads of that on the internet, however I'm not Linux savvy.

Problem:

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.

Notes:

  • 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
    
Nobody is willing to help eh ? –  Bob Feb 1 '13 at 0:44
add comment

1 Answer

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
    
I would gladly supply necessary infomration if i knew what was relevant and how to get it. ps auxwww | grep php outputs: root 10236 0.0 0.0 7548 860 pts/0 S+ 07:10 0:00 grep php Machine is a server and needs to be secure, so a highest level of security and restrictions should be applied. I'll agree that files do not scale, but data to be stored there is not suitable to have it's own place in a database. –  Bob Jan 27 '13 at 23:16
    
If you want the machine to be secure then you need the skills to manage / configure it. –  symcbean Jan 28 '13 at 9:29
    
oh the amazing helpfulness of that comment... (Captain obvious says: Sarcasm) –  Bob Jan 28 '13 at 14:05
    
If you people don't help then you are damn useless in the first place. –  Bob Feb 3 '13 at 15:39
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.