How to Run windows shell commands from PHP

preview_player
Показать описание
How to execute shell commands from PHP. We will run windows shell commands from PHP. This is a tutorial series on how to run external scripts from php easily.

Run/Execute External Script/Language/Program in PHPPART-1

Run windows command from PHP.
A PHP Environment (Where we will execute external scripts.) (We are using XAMP)

Basic Knowledge of Command Prompt.

string exec ( string $command [, array &$output [, int &$return_var ]] )
First parameter is the command to run.
Second optional parameter is the output array. Here each line of the output will be stored in the array variable.
Third optional parameter the integer variable, where the return value of this function will be stored. If it runs successfully, it will return 0, 1 otherwise.

2. shell_exec()
string shell_exec ( string $cmd )
Only parameter is the command to execute.
This function returns the output of the executed command.

Рекомендации по теме
Комментарии
Автор

okay ! how to use exe run ? for example calc.exe or other programs " my computer ", "desktop" , "downloads" or Open the c:\ disk explorer ?

mertoglucevretasarm
Автор

Can you please tell us how to give input to external Java program through php??? Its urgent

shiramoin
Автор

how can i execute this command on server?

lakshmikumar
Автор

what if I need to use another directory. I mean another location.

ahamedtareq
Автор

hello dear i need some help can you ??

wowtechnologies
visit shbcf.ru