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.
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
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
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
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
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
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
5. Run
/usr/local/bin/php-fpm #查看是否运行 netstat -anop | grep php
and the following interface will appear. Normal operation:
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!