Odpalanie exe z poziomu PHP

0

Mam program ktory odpalam z "wiersza poleceń":

moj_programik.exe plik.txt

Chce go odpalic z poziomu skryptu PHP niestety Windows XP pokazuje mi palec ;(

Probowalem nawet tego :

<?php function windExec($cmd,$outputfile = "C:\tmp.txt"){ // runs a command line and returns // the output even for Wind XP SP2 // example: $cmd = "fullpath.exe -arg1 -arg2" // $outputString = windExec($cmd,"C:\\my_alternate\\path_to\\a_tmp_file.txt"); print "Wnetrze funkcji"; // Setup the command to run from "run" $cmdline = "cmd /C $cmd > $outputfile"; // Make a new instance of the COM object $WshShell = new COM("WScript.Shell"); // Make the command window but dont show it. $oExec = $WshShell->Run($cmdline, 0, true); // Read the file file. $retArr = file($outputfile); // Delete the temp_file. unlink($outputfile); // convert array to string $retStr = implode(' ', $retArr); print "Wnetrze funkcji, koniec"; return $retStr; } $cmd = "moj_programik.exe plik.txt"; $outputString = windExec($cmd,"C:\\my_alternate\\path_to\\a_tmp_file.txt"); ?>

Jezeli ktos moze cos polecić w tej materii to proszę o pomoc, jestem nawet gotów dostarczyc moj_programik.exe z plik.txt i zlecic to zadanie za $.

Sebar

0

A jezeli by Ci sie nawet odpalil to jaki to ma cel? Program tylko zadziala na serwerze a z komputerem klienta nic nie zdziala.

0

ma sens, program może szybciej wykonać operacje i mieć większe bezpieczeństwo, a wyrzucać kod html jako wyjście i to dostanie klient, no nie wiem, ja nigdy nie korzystałem i nie było mi to potrzebne no ale to zwykła funkcja exec nie działa ? na Alacerze wystarczy wgrać plik do folderu cgi-bin i włączyć funkcję modułu cgi ;P

0

a nie funkcja system() przypadkiem?

dodane:

string system ( string command [, int &return_var] )

system() is just like the C version of the function in that it executes the given command and outputs the result.

W C też jest ;)

0

system() to chyba w C :) a zobacz taki kod:

<?php echo `dir` ?>

1 użytkowników online, w tym zalogowanych: 0, gości: 1