JustFoo Posted July 19, 2006 Share Posted July 19, 2006 Hello,Im trying to run a program from php using exec function but the only thing im getting returned is Array() and -1The program just checks the file type of the file and prints out in the command line what it is and i need that information[code]$test = exec("start /B c:\Program"." Files\GnuWin32\bin\file.exe C:\PHP\php.exe", $output, $return);print_r($output);echo "<br />".$return."<br />";echo $test."<br />";[/code]thanks for any help Quote Link to comment https://forums.phpfreaks.com/topic/15042-need-help-with-exec/ Share on other sites More sharing options...
Ninjakreborn Posted July 19, 2006 Share Posted July 19, 2006 exec() and system() are dangerous when running through user input, make sure you never give the end users the ability to run anything through exec or system without severe cutting down, and checking there text, also I don't know how to help on this specifically but some advice. Quote Link to comment https://forums.phpfreaks.com/topic/15042-need-help-with-exec/#findComment-60487 Share on other sites More sharing options...
tomfmason Posted July 19, 2006 Share Posted July 19, 2006 I am also some what new to this function. But here is a script that I use to reload ISC Bind. It returns the message "Sever restarted successfuly"Maybe this will work for what you want.[code=php:0]<?php$handle = popen( 'C:\windows\system32\dns\bin\rndc.exe reload', 'r');echo fread( $handle, 4096 );pclose( $handle );?>[/code]Business man is right that it is dangerous to allow users to run anything through exec or system.Good luckTom[b]P.S.[/b] [i]when ever you get it working, please post the fix[/i] Quote Link to comment https://forums.phpfreaks.com/topic/15042-need-help-with-exec/#findComment-60490 Share on other sites More sharing options...
JustFoo Posted July 19, 2006 Author Share Posted July 19, 2006 I gave popen a try and still no dice any other ideas it seems the exe is not running or im just not getting back the output but im guessing more towards the exe not running at all. Quote Link to comment https://forums.phpfreaks.com/topic/15042-need-help-with-exec/#findComment-60500 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.