views:

40

answers:

4

Hello, how can I make sure that Apache/web server user is allowed to execute shell commands? I would like to execute a shell command in PHP script but it doesn't work for some reason (it works when written manually in shell by hand, of course, so the command is surely correct).

I believe the problem is that the user PHP is running under cannot execute shell commands. How can I check that and change the user's rights to use shell?

I'm using Windows 7, Apache 2.2, PHP 5.2.x.

+1  A: 

I believe your question would be a little more appropriate on this site: http://serverfault.com/

Does the file have execute permissions for the apache user? If only that was Linux, I could be of more help than that...

vlood
+1  A: 

Your server error logs should have some information on why the shell command failed (permissions, PHP settings etc.). That should give you an indication on how to activate it.

Noufal Ibrahim
+1  A: 

Perhaps this can help:

How to Grant Permissions in Windows 7

  1. Locate the file or folder on which you want to take ownership in windows explorer

  2. Right click on file or folder and select “Properties” from Context Menu

  3. Click on Edit button in Properties windows Click ok to confirm UAC elevation request.

  4. Select user/group from permission windows or click add to add other user or group.

  5. Now under Permission section check the rights which you want to grant i.e check

Redlab
+1  A: 

See this comment: http://de3.php.net/manual/en/function.exec.php#97187

Radek Suski
Well, I know exec() works. I don't need to confirm that.
Richard Knop