I’ve made a simple webpage that has to run some simple bash scripts. I run apache2 on Jetson Nano and I have three files in /var/www/html
folder:
- index.html
- testexec.php
- test.sh
First one looks like:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>TEST</title>
</head>
<body>
<form action="testexec.php">
<input type="submit" value="Create file">
</form>
</body>
</html>
the php file:
<?php
$output = shell_exec("test.sh");
header('Location: http://192.168.25.16/index.html?success=true');
?>
script:
#!/bin/bash
touch file.txt
My problem is that everything looks good, but the scrit doesn’t run. In future it will be used to run program written in python, but for now I can’t run even that simple one. Is the problem with location of files or with something else?
I’ve already tried to change php file
$output = shell_exec("test.sh");
with
$output = exec("test.sh");
with or without $output
My browser (firefox) returns no errors in console.
Script works fine when I run it from shell. It is executable.
I’ve already tried to look for similar problems, but there were no solutions.