Question

may i know what permission do i need to add, to allow test.php to able to write file into macos filesystem

PHP Error: <br />
<b>Warning</b>:  file_put_contents(20090915203127.jpg) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in <b>/Library/WebServer/Documents/testphp/test.php</b> on line <b>8</b><br />
ERROR: Failed to write data to 20090915203127.jpg, check permissions

this is the error i get on leopard, i already chmod ugo+x for test.php

Was it helpful?

Solution

As far as I know you need root rights to be able to write directly to /Library. Is it absolutely necessary to write to this directory?

If you just write files to your own account, under /Users/accountname it should work (although that depends on the user who is executing the php script).

OTHER TIPS

It's not the file that needs permissions, it's the process running PHP. Assuming you're using (Snow) Leopard in it's default state, you'll need to give the _www user write permissions to the given directory, or give the world write access (a less savoury idea). Both of these can be accomplished with a combination of chown and chmod.

You need to make sure the user the script is running under is allowed to write to the file trying to write to (i.e. 20090915203127.jpg, not the PHP script). If 20090915203127.jpg does not exist, you'll need to make sure the directory that file's going to is writable (by default this will be the present working directory).

You may need to read about chmod.

You need to make the target file / directory writable to the web server. test.php is not into that...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top