How to install php-fpm under linux

王林
Release: 2020-09-29 11:55:19
Original
4871 people have browsed it

How to install php-fpm under Linux: 1. Download the compressed package and decompress it; 2. Enter the decompression directory and execute the [./configure] command to configure the installation environment; 3. Edit the configuration file and enable the corresponding functions ;4. Execute the [/usr/local/bin/php-fpm] command to run.

How to install php-fpm under linux

Specific method:

(Recommended tutorial: linux tutorial)

1. Install the compilation environment

Considering that some components of the built-in source are not available, you can install the epel third-party source first

yum -y install epel-release
yum -y install gcc automake autoconf libtool make gcc-c++ glibc libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel libmcrypt mcrypt mhash  php-mcrypt
Copy after login

2. Download the php version package

The version package of this installation environment is php5.6

wget http://cn2.php.net/distributions/php-5.6.24.tar.gz
tar zvxf php-5.6.24.tar.gz
cd php-5.6.24
Copy after login

3. Compile

During the php compilation process, If you want PHP to support corresponding functions, you need to install the corresponding components first and then compile.

./configure --prefix=/usr/local/php  --enable-fpm --with-mcrypt --enable-mbstring --disable-pdo --with-curl --disable-debug  --disable-rpath --enable-inline-optimization --with-bz2  --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli 
make && make install
Copy after login

4. Configuration file

Copy the configuration file, modify some of the codes, and enable functions in php as needed

cp php.ini-development /usr/local/php/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp sapi/fpm/php-fpm /usr/local/bin
Copy after login

Modify the php-fpm.conf configuration file, use the www user and www user group to run

vim /usr/local/php/etc/php-fpm.conf
#修改为以下
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
user = www
group = www
Copy after login

to modify php.ini and enable the required php functions according to the needs

vim /usr/local/php/php.ini
#############################
display_errors = On
display_startup_errors = On
error_prepend_string = "<br><font color=#ff0000>"
error_append_string = "</font><br><br>"
fastcgi.impersonate = 1
date.timezone = asia/Shanghai
extension=php_mysql.dll
extension=php_gd2.dll
extension=php_mbstring.dll
Copy after login

5. Run

/usr/local/bin/php-fpm
#查看是否运行
netstat -anop | grep php
Copy after login

and the following interface will appear. Normal operation:

How to install php-fpm under linux

Related recommendations: php training

The above is the detailed content of How to install php-fpm under linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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