trouble with exec() with win2k and IIS

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
tchenowe
Forum Newbie
Posts: 13
Joined: Fri Oct 01, 2004 5:35 pm

trouble with exec() with win2k and IIS

Post by tchenowe »

Anyone have experience getting exec() to work on a win2k machine running IIS. I'm doing the following exec('c:\php\php c:\dir\file_name.php" $array). When I type the command portion (c:\php\php c:\dir\file_name.php) at the command line it works fine. But using the exec() command in my script is causing the script to hang. Any suggestions?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

without seeing the real code, make sure you double up the backslash characters in your path strings.

On other notes: Why are you executing a php script? Why not just [php_man]include()[/php_man] it?
tchenowe
Forum Newbie
Posts: 13
Joined: Fri Oct 01, 2004 5:35 pm

Post by tchenowe »

I got the backslash characters setup correctly (printed them out to the screen to make sure). As to why I am using exec() instead of include(), this is a project I am doing to help my students learn basic programing skills. The students will type code into a text area, which will be saved to a file and then the file run using exec(). There is a thread discussing the security impliations of what I am doing called (I think) "can PHP call itself?"

However, the include() might still work. I'll test it.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

[php_man]features.commandline[/php_man]

in windows, the php command line executable is called php-cli.exe or php-win.exe :)

instead of creating a file each time, you could use the -r option and dump the contents of the textarea?
tchenowe
Forum Newbie
Posts: 13
Joined: Fri Oct 01, 2004 5:35 pm

Post by tchenowe »

Thanks Tim. I'll try that.
Post Reply