当前位置: 代码迷 >> PHP >> 关于php使用system()开启linux下的firefox,报错:Error:no display specified,该如何处理
  详细解决方案

关于php使用system()开启linux下的firefox,报错:Error:no display specified,该如何处理

热度:695   发布时间:2012-05-27 05:42:30.0
关于php使用system()开启linux下的firefox,报错:Error:no display specified
求各位大侠帮助?

------解决方案--------------------
是否有操作权限?

代码呢?
------解决方案--------------------
浏览器访问和终端下的访问是两个权限。浏览器中是普通用户权限,你在机子上装sudo
#查询sudo版本
apt-cache search sudo
#安装sudo
apt-get install sudo
然后:system("sudo firefox http://www.baidu.com"); //切换至root权限

------解决方案--------------------
探讨

全部代码是这样的:
$cmd = "sudo firefox --saveimage http://baidu.com";
system($cmd,$str);
echo $str;
我想要实现的是开启firefox把整个网页保存成图片
  相关解决方案