本文介绍了从php运行zenity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

在我的本地ubuntu机器上,我想从php脚本中弹出一条带有zenity的消息.所以我把:

exec("zenity --info --text 'TEST' " );

但是什么也没发生.在shell中键入时,同一行工作正常.我尝试用不同的组合添加--display参数,但是没有运气.

出于安全原因,是否可能需要以某种方式启用exec命令?还是我做错了什么?

谢谢

解决方案

是来自终端(php cli)还是mod_php?在终端上的我的机器上,这似乎工作正常.如果这是服务器箱,则很可能是php硬化了.检查您的php.ini.

如果您尝试通过浏览器执行的php脚本使用zenity,则情况完全不同.由于php解释器将以其他用户身份运行,因此您需要确保允许该用户在X会话上运行程序.检查xauth并阅读Xorg如何验证会话等的信息,但请确保您注意所做的任何更改可能带来的安全隐患.

In my local ubuntu machine I would like to popup a message with zenity from a php script.so i put:

exec("zenity --info --text 'TEST' " );

but nothing happens.The same line works fine when typed in a shell.I tried adding the --display parameter with different combinations but no luck.

Was thinking maybe exec commands need to be enabled somehow for safety reasons?Or what am I doing wrong?

Thanks

解决方案

Is this from the terminal (php cli) or mod_php? This seems to work fine on my machine on the terminal. If this is a server box it is highly likely that php is hardened. Check your php.ini.

If you're trying to use zenity from a php script executed by a browser, this is a wholly different story. As the php interpreter will be run as a different user, you need to make sure that this user is allowed to run programs on your X session. Check xauth and read up on how Xorg authenticates sessions etc., but make sure you pay attention to the possibly security implications that may result from any changes you make.

这篇关于从php运行zenity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 02:28