search
HomeBackend DevelopmentPHP7The installation and use journey of PHP7 on the development machine

Download 7:

$ cd
$ mkdir php7test
$ cd php7test
$ wget http://cn2.php.net/get/php-7.0.7.tar.gz/from/this/mirror
$ tar -zxvf php-7.0.7.tar.gz
$ cd php-7.0.7

Install some dependencies:

$ yum -y install libjpeg libpng freetype libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel curl-devel libxslt-devel lib2 lib2-devel

Configure configure

$ ./configure --prefix=/data/php7 --with-config-file-path=/data/php7/etc --with-config-file-scan-dir=/data/php7/etc/php.d --with-mcrypt=/usr/include --enable-mysqlnd --with-mysqli --with-pdo-mysql --enable-fpm --with-fpm-user=xxxxxxxxxx --with-fpm-group=xxxxxxxxxx --with-gd --with-iconv --enable-xml --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --with-zlib --enable-bcmath --enable-sockets

Then:

$ make
$ make install

After the default installation, you will find There is no php.ini file under /data/php7/etc. Where can I get this? It is available in the source code installation package of php7.

Enter the directory of the source code installation package

$ cd 
$ cd php7test/php-7.0.7
$ ls

You can see that there are two php.ini-xxx files

$ cp php.ini* /data/php7/etc/
$ cp php.ini-production /data/php7/etc/php.ini

Enable php-fpm

Configure the config file first

$ cd /data/php7/etc
$ cp php-fpm.conf.default php-fpm.conf
$ cp php-fpm.d/www.conf.default php-fpm.d/www.conf

When ./configure before compilation, we have already determined some configurations, such as the user and user group running fpm, so the default configuration should not be There will be path problems and permission problems.

Get the service loading of php-fpm

We hope to use the operations of service php-fpm start|stop|restart to restart the service, but it is not as complicated as nginx. PHP is compiled well After that, we were provided with a php-fpm program, which did not require me to write and share it anymore. This file is placed in the PHP compiled source code directory:

$ cd 
$ cd php7test/php-7.0.7/sapi/fpm
$ cp init.d.php-fpm /etc/init.d/php-fpm
$ chmod +x /etc/init.d/php-fpm
$ chkconfig --add php-fpm
$ chkconfig php-fpm on

Through the above operation, we can use service php-fpm start to enable php-fpm. Use ps -ef | grep php-fpm to check the process.

Or start php7 by using /data/php7/sbin/php-fpm.

Finish & Success

Recommended tutorial: "PHP7"

The above is the detailed content of The installation and use journey of PHP7 on the development machine. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:segmentfault. If there is any infringement, please contact admin@php.cn delete

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment