JohnyR
JohnyR

Reputation: 3

PHP Exec execute two commands at the same time in linux

I want to execute two commands at the same time, I am using if((bool)@$ip) shell_exec("command1; command2");

it does work but it needs to finish one command and then it will start to do the other command.

Can I have some help please? Thanks

Upvotes: 0

Views: 692

Answers (1)

mti2935
mti2935

Reputation: 12027

If you put the & symbol at the end of the first command, it will run that command in the background (asynchronously) so that your PHP script will continue to the next line, where you can fire off the next command.

Upvotes: 2

Related Questions