I have a remote linux server, that contains a jar file, that I would like to be able to open.
Its path is /home/files/java/exec.jar
.
I tried executing it through PHP, and I needed to put it in the folder /var/www/html/run_jar.php
.
Here is the code I achieved:
<?php
$path = '/home/server/spigot-1.13.2.jar';
$exists = file_exists($path);
if($exists){
echo 'File exists, running...<br>';
$msg = shell_exec('java -jar '.$path);
echo '"'.$msg.'"';
} else {
echo 'File doesn\'t exist';
}
?>
However when opening the php on google chrome, it says the file doesn't exist, when it clearly does. Are there any permission I should be aware of? And how would I manage to actually run the jar on the remote server? Thanks!