I'm running the conventional install of PHP and Apache on OSX 10.5.8, and also the CHMOD configurations from the folder I'm attempting to open in (orders) is 777, the audience is _WWW.

$filename = 'orders/54c9942b.txt';

if (!$handle = fopen($filename, 'w')) {

I recieve the next:

Warning: fopen(orders/54c9942b.txt) [function.fopen]: failed to open stream: Permission denied in /Users/New/Sites/thisisnothere/order-save.php on line 36

*Edit: I examined it on my small webserver (one I purchase, not just one I setup) and delay pills work when i expected. This leads me to think this is an problem with configuration of my server, maybe an access problem in Apache? or PHP? I'm completely not really acquainted with setting up Apache.

The permission that means something is the file, not your directory it's in. I am sure this is where your condition is.

"If you're looking to get the program to operate and you're simply getting errors, you might like to check you have granted your PHP file use of write information towards the hard disk" obtained from tizag.com So seems like you need to set the permissions around the php file itself, as Tyler mentioned.

Use the entire filesystem path inside your fopen() command and find out in the event that works. Check it out elsewhere you realize works, too (possibly /tmp).

I've got a solution for you personally, but I'm not a burglar guru, so make use of this solution only in your localhost and when your computer data isn't sensitive like charge card amounts, medical information etc. Maybe another experts here discuss that.

It is important should you call php yourself on a console or maybe you call exactly the same php file via the local web server. I discovered that my mac (lion) runs php through the web server because the user "localaccounts".

I Quickly have solved the problem the following:

Step One: Alter the number of the present directory and also the files you need to be modified through the web server towards the group known as "localaccounts". E.g. Go into the following command in the terminal to use this to the present directory, a subdirectory "user images" and also the file foo.sqlite.

chgrp -R localaccounts . foo.sqlite user\ images/

Step Two: Grant the audience people write permission while using commad

chmod g+w -R . foo.sqlite user\ images/

Observe that the us dot means current directory.

I attempted exactly the same factor on my small webhoster, however they do not let it by doing this. Rather they adviced me to make use of PHP CGI. PHP could be then performed like my FTP User access. I suppose that's safer, however i haven't attempted this yet.