Running python script in bash file with php
I am trying to run a simple python script (name.py):
#!/usr/bin/env python
name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
with the following bash script (Helloworld.sh):
#!/bin/bash
python name.py
via the following php
<!DOCTYPE html>
<html>
<body>
<?php
if (isset($_POST['Submit1'])) {
echo shell_exec('sh /home/administrator/Desktop/Helloworld.sh');
}
?>
<form action="myfilename.php" method="post">
<p><Input Type = "Submit" Name ="Submit1" Value = "Save Parameters">
</form>
</p>
</body>
</html>
Log error:
python: unable to open file 'name.py': [Errno 2] No such file or directory
The bash file works fine with the terminal. What should I do?
+3
source to share