且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从PHP命令行启动GUI程序,但Apache不

更新时间:2023-02-22 10:22:57

听起来有点危险,但基本上你可以添加甚至出口显示器=:0.0 apache和启动脚本(如Linux中/etc/init.d/httpd或Apache取决于发行)。
而xhost的+需要在连接到本地X服务器作为用户帐户运行,虽然我只知道它将如何为PHP脚本的工作不仅要在有生之年的Apache HTTP请求正在进行。

Sounds bit hazard, but basically you can add even export DISPLAY=:0.0 to apache start-up script (like in Linux /etc/init.d/httpd or apache depending distro). And "xhost +" need to be run on account which is connected to local X server as user, though I'm only wondering how it will work as php script should only live while apache http request is on-going.

编辑:
难道这是一种应用程序启动的?你可以用EXEC(nohub的/ usr / bin中/ PHP的运行script.php&安培;)此产卵; ..现在的Apache应该被释放和php应该继续在后台工作。

Is this is kind of application launcher?, you can spawn this with exec("nohub /usr/bin/php script.php &"); .. now apache should be released and php should continue working in background.