09/10/2018, 23:59

execute file .exe in PHP

I wanna run command to execute file .exe by using PHP. Anyone can help me do it ? I did try to use system(), exec() and shell_exec() but it didn't work.
Do I have to config php.ini or something to use those functions?
Thanks.
tin_truc22 viết 02:03 ngày 10/10/2018
Chắc gì server đã là windows mà execute exe.
pixelart viết 02:14 ngày 10/10/2018
server windows moi dùng hàm đó được mà
shinichi_bien viết 02:10 ngày 10/10/2018
không phải server windows thì hỏi chạy file .exe làm gì.
Windows 2003, Apache 2 PHP 5

nếu dùng thì dùng như thế nào hả bạn ?
3do viết 02:11 ngày 10/10/2018
lệnh exec của bạn như thế nào? lỗi trả ra là gì? kết quả của phpinfo() là gì?
shinichi_bien viết 02:02 ngày 10/10/2018
exec ('run "C:\Program Files\Internet Download Manager\IDMan.exe" /d "http://gal9x.net/test.zip"');

hoac la

exec ('"C:\Program Files\Internet Download Manager\IDMan.exe" /d "http://gal9x.net/test.zip"');

thu ca 2 deu khong duoc ?

http://sv1.galanime.com/phpinfo.php
shinichi_bien viết 02:09 ngày 10/10/2018
ko trả lại lỗi gì cả, trắng tinh
shinichi_bien viết 02:08 ngày 10/10/2018
thử dùng exec với lệnh del chẳng hạn exec("del test.zip"); thì chạy tốt
3do viết 02:01 ngày 10/10/2018
IDM chạy theo cách của bạn không thể chạy bằng lệnh exec được. Command

Code:
"C:\Internet Download Manager\IDMan.exe" /d "http://gal9x.net/test.zip"
khi chạy sẽ bật 1 dialog của IDM lên. Nếu muốn download, có thể dùng wget


Đây là 1 script mẫu, nó sẽ xuất các lỗi khi thực thi ra

PHP Code:
<?php

exec 
('cmd "abc.exe" 2>&1'$output$return);
echo 
"output ...";
var_dump($output);

echo 
"\nreturn ";
var_dump($return);
cần chú ý đến cặp dấu " " bao abc.exe và 2>&1
shinichi_bien viết 02:01 ngày 10/10/2018
IDM chạy được mà thêm cái /n là tự động download thoai những chắc tớ ko dùng PHP chạy nữa viết file bat chạy cho nhanh anyway, thanks ^^
Bài liên quan
0