I am having an issue with executing my python script through using a button on PHP. I looked through any or all relevant questions regarding my issue, and tried any answers i could find and modifying the file name to my own. This is the PHP code on my website:
<FORM>
<button type="button" onclick="parent.location='action.php'">open</button>
</FORM>
The PHP code will be executing the python script, which i wrote:
<?
exec("python /var/www/open.py")
?>
The website works, the python script works when i manually execute it on terminal. However, when i try to click on the button on my website, nothing happens. I also went and changed the configs on the sudoers file so that www-data functions without the use of a password, and also did chmod gu+x on /var/www/open.py.
Is there anything else that I might be missing? Can someone help me please?
Thank you.
system
instead ofexec
to avoid need forecho
as seen in comment above<button type="button" onclick="parent.location='action.php'">open</button>
please let me know