Comparison of PHP7 and HHVM
The performance of PHP7 in real-world scenes has indeed been comparable to that of HHVM, in some cases even exceeding the HHVM. HHVM is a multithreaded model, which means that if a thread causes crash, the entire service is hung up and it does not restart automatically. In addition, it uses the JIT, which means that after the restart to warm up, without preheating the situation, the performance is worse. and multithreaded model debugging difficult, which for the pursuit of stable web services, is very unsuitable.
Download
# wget http://php.uberglobalmirror.com/distributions/php-7.0.18.tar.gz
Unzip the installation# tar zxvf php-7.0.2.tar.gz# CD php-7.0.2 First look at the installation help #./configure--help#./configure--prefix=/usr/local/php \
--with-curl \
--with-freetype-dir \
--WITH-GD \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--WITH-LIBDIR=LIB64 \
--with-libxml-dir \
--WITH-MYSQLI \
--WITH-OPENSSL \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--WITH-XMLRPC \
--with-xsl \
--with-zlib \
--ENABLE-FPM \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--ENABLE-GD-NATIVE-TTF \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--ENABLE-PCNTL \
--ENABLE-SHMOP \
--ENABLE-SOAP \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip
If the configuration is wrong, the required modules need to be installed and the dependent libraries will be installed directly with Yum
# yum-y Install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel
Note: When installing PHP7BETA3, there are several configurations that need Yum, and now php-7.0.2 is no longer necessary. # yum-y installed curl-devel# yum-y install libxslt-devel compile installation # make && make install
can go to the installation directory to view the generated files
It is important to note that although the PHP installation is complete, the configuration file is not found because the profile php.ini needs to be created from the installation package itself
Create a php-fpm.conf file
Create a www.conf file
If you do not create a *.conf file, you will get an error when starting PHP-FPM because it is a PHP-FPM configuration file
Nginx Connection to PHP
Add the following file in the nginx.conf
1 Location ~ \.php$ {2 root html;3 fastcgi_pass 127.0.0.1:9000;4 fastcgi_index index.php;5 Fastcgi_param script_filename/usr/local/nginx/html$fastcgi_script_name;6 include fastcgi_params; 7 }
Test start PHP-FPM
The default is listening on 9000 port, can be modified in the PHP-FPM configuration, my configuration file path is as follows
/usr/local/php/etc/php-fpm.d/www.conf
Start Nginx
Edit the contents of the test file as follows Touch 1.php
Vim 1.php
<?php phpinfo();
The test results are as follows
Linux Source installation php7.0 Yum