Page 1 of 1

trouble with exec() with win2k and IIS

Posted: Mon Oct 18, 2004 1:51 am
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?

Posted: Mon Oct 18, 2004 2:00 am
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?

Posted: Mon Oct 18, 2004 10:58 am
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.

Posted: Mon Oct 18, 2004 11:15 am
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?

Posted: Mon Oct 18, 2004 8:20 pm
by tchenowe
Thanks Tim. I'll try that.