HTML button launch Shell script

删除回忆录丶 提交于 2020-01-16 12:00:12

问题


Working with:

  • Linux Debian
  • Lighttpd Server
  • PHP7.0

I want to launch some shell scripts pressing HTML buttons. All the files are placed in /var/www/html The rights are done by:

sudo chown www-data:www-data /var/www/

So, I wrote some code:

HTML test code (index.html):

<form action="openApp.php">
    <input type="submit" value="Open Script">
</form>

PHP test code (openApp.php):

<?php
    exec('nautilus');
    header('Location: http://localhost/index.html?success=true');
?>

But no luck, nothing is working.

Also, my Lighttpd configuration file is like that:

server.modules = ( "mod_access", "mod_alias", "mod_compress", "mod_fastcgi", "mod_redirect", )

May be I am wrong with that piece of code. Do I need some Javascript to do the job ? May be the rights are wrong ?

Could you help me please ? I am stuck with that.

来源:https://stackoverflow.com/questions/59191195/html-button-launch-shell-script

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!