<?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
$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
on a mac, you'd need the command to actually open the app, like:
exec( 'open SomeApp.app' );
I think on Windows you would use 'start' (?)
exec( 'start notepad++.exe' );
PHP exec function passing a value to command line
Any way to SAFELY execute shell scripts from PHP?
php exec() or system() or even shell_exec()... | KnownHost Community Forum
PHP exec() not working | php.ini is fine
Videos
I have a website accessible from https://exampleurl.com:1234 (i.e. nonstandard port).
After logging in, this website gives my users a GUI and a few buttons. The buttons interact with PHP scripts on an Unraid VM, which then launch shell scripts. The shell scripts are used for controlling streams via streaming software called "OBS-Studio".
Here's an example:
my.php
<?php
$output = shell_exec("/bin/bash /var/www/html/streamstart.sh");
echo $output;
?>
streamstart.sh
#!/bin/bash
obs-cmd streaming startI'm relatively new to PHP, and I'm not sure how this could be exploited. Is there a way to make this more secure?
I have set the password for my users to be extremely secure, but that feels like the only line of defense right now.