Jump to content

Need help with exec()


JustFoo

Recommended Posts

Hello,

Im trying to run a program from php using exec function but the only thing im getting returned is Array() and -1
The 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
Link to comment
https://forums.phpfreaks.com/topic/15042-need-help-with-exec/
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/15042-need-help-with-exec/#findComment-60487
Share on other sites

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 luck
Tom

[b]P.S.[/b] [i]when ever you get it working, please post the fix[/i]
Link to comment
https://forums.phpfreaks.com/topic/15042-need-help-with-exec/#findComment-60490
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.