exec() Problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
icarpenter
Forum Commoner
Posts: 84
Joined: Mon Mar 07, 2005 8:12 am
Location: Kent, England

exec() Problems

Post by icarpenter »

I am calling the exec() function...

Code: Select all

exec('dir',$test);

foreach ($test as $key => $value)	{
	echo"$key, $value\n";
	}
But I keep getting the following error!!!

Warning: exec(): Unable to fork [dir] in c:\inetpub\wwwroot\test.php on line 4

This works OK from the command line but not on in IIS.

Has anyone come accross this one before?

Rgds Ian
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Sounds like shell access is denied to Apache...

What does this do?

Code: Select all

echo `dir`; //Note the backticks
User avatar
icarpenter
Forum Commoner
Posts: 84
Joined: Mon Mar 07, 2005 8:12 am
Location: Kent, England

Post by icarpenter »

I get...

Warning: shell_exec(): Unable to execute 'dir' in c:\inetpub\wwwroot\test.php on line 5

Is this a permissioning issue do you think?
User avatar
icarpenter
Forum Commoner
Posts: 84
Joined: Mon Mar 07, 2005 8:12 am
Location: Kent, England

Post by icarpenter »

Iv'e got it it was a file permissioning issue on CMD.exe for internet users...

Thanks for your help Ian...
Post Reply