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

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

Jun 13, 2016 am 10:24 AM
firefox quot sudo system

关于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把整个网页保存成图片
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to install Oracle Linux on Windows 10 or 11 WSL – Subsystems How to install Oracle Linux on Windows 10 or 11 WSL – Subsystems Apr 14, 2023 pm 10:07 PM

Steps to Install Oracle Linux 8 or 7.5 on Windows 10 | 11 WSL 1. Enable WSL – Windows Subsystem for Linux The first thing we need to have is WSL, enable it if it is not already enabled. Go to the search box and type – Turn Windows features on or off. When the option appears, click to open the same. In the window that opens, scroll down and select the box provided for Windows Subsystem for Linux. Then click the OK button. Restart the system afterwards to apply the changes. 2. Download OracleLinx8 or

How to run SUDO commands in Windows 11/10 How to run SUDO commands in Windows 11/10 Mar 09, 2024 am 09:50 AM

The sudo command allows users to run commands in elevated privilege mode without switching to superuser mode. This article will introduce how to simulate functions similar to sudo commands in Windows systems. What is the Shudao Command? Sudo (short for "superuser do") is a command-line tool that allows users of Unix-based operating systems such as Linux and MacOS to execute commands with elevated privileges typically held by administrators. Running SUDO commands in Windows 11/10 However, with the launch of the latest Windows 11 Insider preview version, Windows users can now experience this feature. This new feature enables users to

Steps to install Adminer on Windows 10 or 11 Steps to install Adminer on Windows 10 or 11 Apr 23, 2023 pm 04:40 PM

Steps to install Adminer on Windows 11 or 10 You can follow these steps to install Adminer on both Windows 11 and 10 operating systems to manage different database systems. 1. Enable WSL on Windows If you have already enabled WSL then go to next step otherwise go to Windows start menu and type “Turn Windows features on or off” and turn it on when its icon appears. Scroll down to Windows Subsystem for Linux, select it, and click the OK button. After WSL installation is complete, a dialog box will appear asking you to restart the system. 2

What is the linux sudo password? What is the linux sudo password? Feb 15, 2023 am 10:34 AM

The Linux sudo password is random, that is, there is a new root password every time you boot up. The method to set a new password is: 1. Enter the command "sudo passwd" in the terminal, then enter the current user's password, and press "Enter" key; 2. Re-enter the new password in the terminal and confirm.

What is sudo and why is it important? What is sudo and why is it important? Feb 21, 2024 pm 07:01 PM

sudo (superuser execution) is a key command in Linux and Unix systems that allows ordinary users to run specific commands with root privileges. The function of sudo is mainly reflected in the following aspects: Providing permission control: sudo achieves strict control over system resources and sensitive operations by authorizing users to temporarily obtain superuser permissions. Ordinary users can only obtain temporary privileges through sudo when needed, and do not need to log in as superuser all the time. Improved security: By using sudo, you can avoid using the root account during routine operations. Using the root account for all operations may lead to unexpected system damage, as any mistaken or careless operation will have full permissions. and

How to enable or disable firewall on Alpine Linux? How to enable or disable firewall on Alpine Linux? Feb 21, 2024 pm 12:45 PM

On AlpineLinux, you can use the iptables tool to configure and manage firewall rules. Here are the basic steps to enable or disable the firewall on AlpineLinux: Check the firewall status: sudoiptables -L If the output shows rules (for example, there are some INPUT, OUTPUT, or FORWARD rules), the firewall is enabled. If the output is empty, the firewall is currently disabled. Enable firewall: sudoiptables-PINPUTACCEPTsudoiptables-POUTPUTACCEPTsudoiptables-PFORWARDAC

How to remove Firefox Snap in Ubuntu Linux? How to remove Firefox Snap in Ubuntu Linux? Feb 21, 2024 pm 07:00 PM

To remove FirefoxSnap in Ubuntu Linux, you can follow these steps: Open a terminal and log in to your Ubuntu system as administrator. Run the following command to uninstall FirefoxSnap: sudosnapremovefirefox You will be prompted for your administrator password. Enter your password and press Enter to confirm. Wait for command execution to complete. Once completed, FirefoxSnap will be completely removed. Note that this will remove versions of Firefox installed via the Snap package manager. If you installed another version of Firefox through other means (such as the APT package manager), you will not be affected. Go through the above steps

Install SSH on the Linux Debian11 server, create a new user and allow SSH remote login, and configure SSH secure login! Install SSH on the Linux Debian11 server, create a new user and allow SSH remote login, and configure SSH secure login! Mar 01, 2024 pm 07:16 PM

The steps to install SSH on your Debian11 server and create a new user to allow SSH remote login are as follows: Step 1: Install SSH In order to install the SSH server, you need to log in to your Debian11 server as the root user or a user with sudo privileges. Execute the following command in the terminal to install the SSH server: sudoaptupdatesudoaptinstallopenssh-server Step 2: Create a new user To create a new user, you can use the adduser command. Replace the following command with your desired username: sudoaddusernew_username You will be prompted to set the new user's password and other

See all articles