When php uses system () to enable firefox in linux, the following Error occurs: Error: nodisplayspecified. how can this problem be solved?

Source: Internet
Author: User
When php uses system () to enable firefox in linux, the following Error occurs: Error: nodisplayspecified. could you please help me ?, Is there operation permission? What about code ?, Browser access and terminal access are two permissions. The general user permission is in the browser. you can install sudo # on the machine to query the sudo version apt-cac. the following Error occurs when php uses system () to enable firefox in linux: Error: no display specified.
Could you please help me?

------ Solution --------------------
Is there operation permission?

What about code?
------ Solution --------------------
Browser access and terminal access are two permissions. General user permissions in the browser. you have sudo installed on the host.
# Querying sudo versions
Apt-cache search sudo
# Install sudo
Apt-get install sudo
Then: system ("sudo firefox http://www.baidu.com"); // switch to root permission

------ Solution --------------------
Discussion

All the code is as follows:
$ Cmd = "sudo firefox -- saveimage http://baidu.com ";
System ($ cmd, $ str );
Echo $ str;
What I want to achieve is to enable firefox to save the entire webpage as an image

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.