Home > Backend Development > PHP7 > The installation and use journey of PHP7 on the development machine

The installation and use journey of PHP7 on the development machine

藏色散人
Release: 2023-02-17 14:22:01
forward
2216 people have browsed it

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
Copy after login

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
Copy after login

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
Copy after login

Then:

$ make
$ make install
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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!

Related labels:
source:segmentfault.com
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template