Post subject: Need help with System() or exec()

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
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

Post subject: Need help with System() or exec()

Post by alexus »

For some reason system() doesn’t want to work…

I used this code:

Code: Select all

exec('C:\WINDOWS\system32\cmd.exe');




I’m running: WinXP SP1, IIS 5.1, PHP 4.3.2
Safe Mode is Off

You can check phpinfo() at
24.188.105.39:88/php/info.php
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Re: Post subject: Need help with System() or exec()

Post by redhair »

Change to:

Code: Select all

<?php
exec('C:\\WINDOWS\\system32\\cmd.exe');
?>
It's mentioned in the php manual, availible here: http://www.php.net
When you would have typed 'exec' in the function list search box, you would have know the answer instantly, since one of the first comments in it refferes to your problem.
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

Post by alexus »

I tried that before: it gives the same error:


Warning: exec(): Unable to fork [C:\WINDOWS\system32\cmd.exe] in c:\inetpub\wwwroot\php\mac\test_1.php on line 13
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Post by redhair »

Warning: exec(): Unable to fork [C:\WINDOWS\system32\cmd.exe] in c:\inetpub\wwwroot\php\mac\test_1.php on line 13
LOL unable to fork?
Thats a weird php version you have there, i never seen such cool error messages.

Maybe it would work if you tried?:

Code: Select all

<?php
exec('C:\\WINDOWS\\cmd.exe'); 
?>
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

Post by alexus »

hey, I have normal version of Windows here... the CMD is always in system32 folder...
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

fork is a unix/posix term, when a process starts another it's forking

Somehow your webserver does not allow PHP for start another process, some sort of safety settings in IIS perhaps?
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

Post by alexus »

cool, now what, turn security Off or give everyone execute permission?
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

Post by alexus »

and if I'll set up new permission... is php using <machine_name>_IUSR or it uses some other service permission?
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Post by redhair »

Stoker wrote:fork is a unix/posix term, when a process starts another it's forking
Thx :wink:
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

I have no idea how Bill Gates compromised software does such.. simply put, the process owner must be allowed to execute the required process (as itself or with run-as permissions for the owner or whatever)..
Post Reply