Before we introduced LAMP,LNMP and lamp is the Apache for Nginx,nginx is also a popular Web server, in processing high concurrent requests, performance is far better than Apache. Apache uses PHP as one of its own extension modules, and Nginx combines a separate PHP service.
1. Install MySQL
cd /usr/local/srcwget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gzmv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysqlcd /usr/local/mysqluseradd mysqlmkdir /data/./scripts/mysql_install_db --user=mysql --datadir=/data/mysqlcp support-files/my-default.cnf /etc/my.cnf cp support-files/mysql.server /etc/init.d/mysqldvi /etc/init.d/mysqld定义basedir和datadir/etc/init.d/mysqld start
Installation steps are the same as in the lamp environment
2 Installing PHP
(1). Download PHP Source Package
cd /usr/local/src/wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
(2) Unzip the source package, create the user
tar zxf php-5.6.30.tar.gzuseradd -s /sbin/nologin php-fpm
The user is used to run the PHP-FPM service. In the LNMP environment, PHP is a service php-fpm form that exists independently in the system.
(3) to configure compilation options.
CD php-5.6.30
./configure--prefix=/usr/local/php-fpm--with-config-file-path=/usr/local/php-fpm/etc --ENABLE-FPM--with-fpm-user=php-fpm--with-fpm-group=php-fpm--with-mysql=/usr/local/mysql--with-mysqli=/usr/ Local/mysql/bin/mysql_config--with-pdo-mysql=/usr/local/mysql--with-mysql-sock=/tmp/mysql.sock-- With-libxml-dir--with-gd--with-jpeg-dir--with-png-dir--with-freetype-dir--with-iconv-dir--with-zlib-dir-- With-mcrypt--enable-soap--enable-gd-native-ttf--enable-ftp--enable-mbstring--enable-exif--with-pear--with-curl --with-openssl
has more than one--ENABLE-FPM option
(4) compiled and installed compared to lamp. Execute make && make install
The above procedure will generally have errors to be handled
Workaround: Yum install-y libcurl-devel
This time there was no other problem. Because before we install PHP in the lamp environment, we have installed a large number of dependent library files, and one thing is that we have to compile the source package before, to do the
make clean operation, delete the original compiled files.
(5) Configure the Edit configuration file, copy the startup script
vim/usr/local/php-fpm/etc/php-fpm.conf
Write the following content
[global]pid = /usr/local/php-fpm/var/run/php-fpm.piderror_log = /usr/local/php-fpm/var/log/php-fpm.log[www]listen = /tmp/php-fcgi.socklisten.mode = 666user = php-fpmgroup = php-fpmpm = dynamicpm.max_children = 50pm.start_servers = 20pm.min_spare_servers = 5pm.max_spare_servers = 35pm.max_requests = 500rlimit_files = 1024
After saving the configuration file
/usr/lcoal/php-fpm/sbin/php-fpm -tcorrect when detecting configuration under execution
The test successful instructions appear to be configured correctly
Copy the startup script in the PHP source package just now
cp /usr/local/src/php-5.6.30/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
(6) Change the permissions to start the service
chmod 755 /etc/init.d/php-fpm
/etc/init.d php-fpm startOrservice php-fpm start
Linux Learning Summary (39) LNMP Environment Construction 1-mysql,php Installation