Page 1 of 1

Shell_exec gives permission error

Posted: 2011/10/27 07:47:04
by wurstkuchen
Hello,

I'am new to linux and this are my first steps. I hope you can help me.

I have to zip some folders by php with the shell_exec command. The command I use to do that works fine in the shell as root.
With shell_exec I get an error: zip I/O error: Permission denied zip error: Could not create output file .......

I read a lot and think that I have to give the www user the permission to use zip. I installed sudo for that but I have problems with the correct command.

Is that the right way to solve the problem? If yes, who is the correct user for giving access (I read something of www or apache)

Thank you for any advice!


Addon:
I am able to execute something like: "zip -help" by shell_exec.
It has problems with creating the files I think....

Shell_exec gives permission error

Posted: 2011/10/27 08:32:55
by TrevorH
If your command is telling you that it's unable to write the output file then you are probably trying to create it in a directory that the web server has no write access to - and that's probably a good thing since you don't want apache to be able to randomly write to directories containing code. Perhaps all you need to do is fully qualify the output file name - e.g. '/tmp/output.zip'.