Shell_exec gives permission error

Support for webhosts that use CentOS
Post Reply
Posts: 1
Joined: 2011/10/27 07:40:46

Shell_exec gives permission error

Post by wurstkuchen » 2011/10/27 07:47:04


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!

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

User avatar
Forum Moderator
Posts: 29467
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Shell_exec gives permission error

Post by TrevorH » 2011/10/27 08:32:55

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/'.

Post Reply

Return to “CentOS 5 - Webhosting Support”