How to take screenshots of a website using php in Linux

Source: Internet
Author: User
Tags wkhtmltopdf
In Linux, the php implementation method for the website is linuxphp. In the Linux environment, php implements the website method. in this article, the example of linuxphp describes how php implements the website in the Linux environment. For your reference, refer to the following: how php is implemented for the website in the Linux environment: linuxphp

This example describes how to implement php for websites in Linux. We will share this with you for your reference. The details are as follows:

Step 1: Download wkhtmltopdf
The code is as follows: [root @ iZ94aawoublZ ~] # Wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz

Step 2: extract
The code is as follows: [root @ iZ94aawoublZ ~] # Xz-d wkhtmltox-0.12.3_linux-generic-amd64.tar.xz

Step 3: continue decompression
The code is as follows: [root @ iZ94aawoublZ ~] # Tar xvf wkhtmltox-0.12.3_linux-generic-amd64.tar

Step 4: Select a directory
The code is as follows: [root @ iZ94aawoublZ ~] # Cd wkhtmltox
[Root @ iZ94aawoublZ wkhtmltox] # ls
Bin include lib share

Step 5: Select the lib Directory
The code is as follows: [root @ iZ94aawoublZ wkhtmltox] # cd lib/
[Root @ iZ94aawoublZ lib] # ls
Libwkhtmltox. so libwkhtmltox. so.0 libwkhtmltox. so.0.12 libwkhtmltox. so.0.12.3

Step 6: copy libwkhtmltox. so to usr/local/lib
The code is as follows: [root @ iZ94aawoublZ lib] # cp libwkhtmltox. so/usr/local/lib
[Root @ iZ94aawoublZ lib] # cd ../include/

Step 7
The code is as follows: [root @ iZ94aawoublZ include] # cp-R wkhtmltox // usr/local/include/

Step 8: install php wkhtmltox
The code is as follows: [root @ iZ94aawoublZ include] # wget https://github.com/mreiferson/php-wkhtmltox/archive/master.zip
[Root @ iZ94aawoublZ include] # ls
Master.zip wkhtmltox

Step 9: extract
The code is as follows: [root @ iZ94aawoublZ include] # unzip master.zip

Step 10: Select a directory
The code is as follows: [root @ iZ94aawoublZ include] # cd php-wkhtmltox-master/

Step 2
The code is as follows: [root @ iZ94aawoublZ php-wkhtmltox-master] #/usr/local/php/bin/phpize
Processing ING:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226

Step 2: install
The code is as follows: [root @ iZ94aawoublZ php-wkhtmltox-master] #./configure -- with-php-config =/usr/local/php/bin/php-config
[Root @ iZ94aawoublZ php-wkhtmltox-master] # make
[Root @ iZ94aawoublZ php-wkhtmltox-master] # make install
Installing shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/

Step 2
The code is as follows: [root @ iZ94aawoublZ php-wkhtmltox-master] # echo "extension = phpwkhtmltox. so">/usr/local/php/etc/php. ini
[Root @ iZ94aawoublZ php-wkhtmltox-master] # service php-fpm restart
Gracefully shutting down php-fpm. done

Test successful

Test knife:

<?phpwkhtmltox_convert(  'image',  array(    'out' => 'test1.jpg',    'in' => 'http://www.163.com/'  ));?>

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.