Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.