<?php

$ret = exec('START C:\Program Files (x86)\Notepad++\Notepad++.exe', $output, $error);

// Debug
var_dump($ret);
var_dump($output);
var_dump($error);
?>

Update

maybe your php hasn't permissions to run commands on your wamp: https://stackoverflow.com/a/9161752/1721486

Answer from spinsch on Stack Overflow
๐ŸŒ
PHP
php.net โ€บ manual โ€บ en โ€บ function.exec.php
PHP: exec - Manual
I tried to execute a command in background under Windows. After struggling for hours with all these half ready examples I would like to share the syntax I found working (for windows at least). This is not tested under Linux as there are more elegant ways to spawn a process. Based on the function from Arno van den Brink. <?php function execInBackground($cmd) { if (substr(php_uname(), 0, 7) == "Windows"){ pclose(popen("start /B ".
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ php โ€บ php-shell_exec-vs-exec-function
PHP shell_exec() vs exec() Function - GeeksforGeeks
July 11, 2025 - Note: This function is disabled when PHP is running in safe mode. Example: In this example we use the shell_exec() function to execute the ls command, listing files and directories.
๐ŸŒ
O'Reilly
oreilly.com โ€บ library โ€บ view โ€บ php-in-a โ€บ 0596100671 โ€บ re48.html
exec() - PHP in a Nutshell [Book]
October 13, 2005 - Nameexec()Synopsis string exec ( string command [, array &output [, int &return_val]] )The exec() function runs an external program, specified in the first parameter. It... - Selection from PHP in a Nutshell [Book]
Author ย  Paul Hudson
Published ย  2005
Pages ย  372
๐ŸŒ
Hacking with PHP
hackingwithphp.com โ€บ 4 โ€บ 12 โ€บ 0 โ€บ executing-external-programs
Executing external programs: exec(), passthru(), and virtual() โ€“ Hacking with PHP - Practical PHP
Note that fortune may not be installed or available to your PHP scripts - contact your system administrator to find out. There are other execution functions available, notably shell_exec() and system(), however they are largely irrelevant - shell_exec(), for example, works in exactly the same ...
๐ŸŒ
Linux Hint
linuxhint.com โ€บ execute_shell_command_php
Execute Shell Command in PHP using exec() โ€“ Linux Hint
<?php //Store the output of the executed command in an array exec('ls -l', $output, $status); //Print all return values of the executed command as array print_r($output); echo "<br/>"; //Print the output of the executed command in each line foreach($output as $value) { echo $value."<br />"; ...
Find elsewhere
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ php exec() function
PHP exec() Function - Scaler Topics
March 18, 2024 - The exec() function in PHP is used to execute a command in the operating system's shell or terminal. It allows PHP scripts to interact with the underlying system and run external programs or commands. The function takes the command as a parameter and returns the last line of the command's output.
๐ŸŒ
ExeOutput for PHP
exeoutput.com โ€บ home โ€บ exeoutput for php help โ€บ using exec(), system() in applications
Using exec(), system() in Applications - ExeOutput for PHP
September 20, 2025 - <?php $mypath = exo_getglobalvariable('HEPublicationPath', '') . 'sample.bat'; echo exec($mypath); ?>
๐ŸŒ
GitHub
github.com โ€บ pastuhov โ€บ php-exec-command
GitHub - pastuhov/php-exec-command: Simple php command executor with param binding ยท GitHub
Command::exec('echo {!path!}', ['path' => '$PATH']);
Starred by 25 users
Forked by 2 users
Languages ย  PHP
๐ŸŒ
Amir Kamizi
amirkamizi.com โ€บ blog โ€บ php-exec
PHP Exec | Amir Kamizi
March 22, 2023 - You can easily run your commands with exec function ... <?php exec('mkdir test', $output, $resultCode); // output is an empty array because there is no returned value // resultCode is 0
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ php โ€บ explain-the-difference-between-shell_exec-and-exec-functions
Explain the Difference Between shell_exec() and exec() Functions - GeeksforGeeks
July 23, 2025 - This function gets disabled when PHP runs in safe mode. ... Parameter: shell_exec() function passes only a single argument($cmd) as it holds the command that is to be executed.
๐ŸŒ
BCCNsoft
doc.bccnsoft.com โ€บ docs โ€บ php-docs-7-en โ€บ function.shell-exec.html
shell_exec
This function can return NULL both when an error occurs or the program produces no output. It is not possible to detect execution failures using this function. exec() should be used when access to the program exit code is required. ... This function is disabled when PHP is running in safe mode.