Page 1 of 1

exec() Problems

Posted: Tue Jul 19, 2005 11:42 am
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

Posted: Tue Jul 19, 2005 12:48 pm
by Chris Corbyn
Sounds like shell access is denied to Apache...

What does this do?

Code: Select all

echo `dir`; //Note the backticks

Posted: Wed Jul 20, 2005 2:04 am
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?

Posted: Wed Jul 20, 2005 3:40 am
by icarpenter
Iv'e got it it was a file permissioning issue on CMD.exe for internet users...

Thanks for your help Ian...