Unlike lamp, the Web service is Nginx, and PHP is a standalone service, and the service is called PHP-FPM. Nginx handles static requests directly, and dynamic requests are forwarded to PHP-FPM. Therefore, in the static page processing, Nginx more than Apache.
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/9E/16/wKioL1mLCsWjQDqyAACMdrsi29E529.png "title=" 1.png "alt=" Wkiol1mlcswjqdqyaacmdrsi29e529.png "/>
Install MySQL
1. Download and unzip
[[email protected] src]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz [[ Email protected] src]# tar zxf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz [[email protected] src]# MV Mysql-5.6.35-linux-glibc2.5-x86_64/usr/local/mysql
2. Create users and folders
[[email protected] src]# cd/usr/local/mysql[[email protected] mysql]# useradd mysql[[email protected] mysql]# Mkdir/da ta/
3. Initialize the database
[email protected] mysql]# Yum install-y perl perl-data-dumper libaio libaio-devel[[email protected] mysql]#./scripts/my sql_install_db--user=mysql--datadir=/data/mysql
4. Copy startup script file
[email protected] mysql]# CP support-files/my-default.cnf/etc/my.cnf CP: Do you want to overwrite "/etc/my.cnf"? Y[[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld
5. Start MySQL
[[email protected] mysql]# vi/etc/init.d/mysqldbasedir=/usr/local/mysqldatadir=/data/mysql[[email protected] MySQL] # chkconfig--add mysqld[[email protected] mysql]# chkconfig mysqld on[[email protected] mysql]# service mysqld StartStart ing mysql.logging to '/data/mysql/juispan.err '. success!
Install PHP
1. Download and unzip
[Email protected] mysql]# cd/usr/local/src[[email protected] src]# wget http://cn2.php.net/distributions/ Php-5.6.30.tar.gz[[email protected] src]# tar zxf php-5.6.30.tar.gz
2. Configure PHP
[Email protected] src]# useradd-s/sbin/nologin php-fpm[[email protected] src]# CD Php-5.6.30[[email protected] 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
During the configuration process, you will encounter a one-to-one configuration failure, which needs to be handled patiently.
Issue 1:configure:error:xml2-config not found. Please check your LIBXML2 installation.
[email protected] php-5.6.30]# Yum install-y libxml2-devel
Issue 2:Configure:error:Cannot find OpenSSL ' s <evp.h>
[email protected] php-5.6.30]# Yum install-y openssl-devel
Issue 3:configure:error:Please Reinstall the BZIP2 distribution
[email protected] php-5.6.30]# Yum install-y bzip2-devel
Issue 4:configure:error:jpeglib.h not found.
[email protected] php-5.6.30]# Yum install-y libjpeg-turbo-devel
Issue 5:configure:error:png.h not found.
[email protected] php-5.6.30]# Yum install-y libpng-devel
Issue 6:configure:error:freetype-config not found.
[email protected] php-5.6.30]# Yum install-y freetype-devel
Issue 7:configure:error:mcrypt.h not found. Please reinstall Libmcrypt.
[email protected] php-5.6.30]# Yum install-y libmcrypt-devel
Issue 8:configure:error:Please Reinstall the Libcurl distribution-easy.h should be in <CURL-DIR>/INCLUDE/CU rl/
[email protected] php-5.6.30]# Yum install-y libcurl-devel
After you have finished processing the above issues, reconfigure the following text:
creating main/internal_functions_cli.c+------------------------------------------------------------------ --+| license: | | this software is subject to the php license, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | if you do not agree with the terms of this license, you must abort | | the installation process at this point. |+--------------------------------------------------------------------+thank you for using PHP.config.status: creating php5.specconfig.status: creating main/build-defs.hconfig.status: creating scripts/phpizeconfig.status: creating scripts/ man1/phpize.1config.status: creating scripts/php-configconfig.status: creating scripts/ man1/php-config.1config.status: creating sapi/cli/php.1config.status: creating sapi/fpm/ php-fpm.confconfig.status: creating sapi/fpm/init.d.php-fpmconfig.status: creating sapi/ fpm/php-fpm.serviceconfig.status: creating sapi/fpm/php-fpm.8config.status:&Nbsp;creating sapi/fpm/status.htmlconfig.status: creating sapi/cgi/php-cgi.1config.status: creating ext/phar/phar.1config.status: creating ext/phar/phar.phar.1config.status: Creating main/php_config.hconfig.status: main/php_config.h is unchangedconfig.status: executing default commands
The above text content indicates the configuration is successful, if you are not at ease can use "echo $?" Confirm under.
3. Compiling and installing
[[email protected] php-5.6.30]# Make[[email protected] php-5.6.30]# make install
4, adjust the PHP-FPM configuration
[[email protected] php-5.6.30]# cp php.ini-production /usr/local/php-fpm/etc/php.ini[[email protected] php-5.6.30]# vi / Usr/local/php-fpm/etc/php-fpm.conf[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[[email protected] php-5.6.30]# /usr/local /php-fpm/sbin/php-fpm -t[08-aug-2017 21:16:46] notice: configuration file /usr/ Local/php-fpm/etc/php-fpm.conf test is successful
5, starting php-fpm
[[email protected] php-fpm]# cp /usr/local/src/php-5.6.30/sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm[[email protected] php-fpm]# chmod 755 /etc/init.d/php-fpm [[ email protected] php-fpm]# chkconfig --add php-fpm[[email protected] php-fpm]# chkconfig php-fpm on[[email protected] php-fpm]# service Php-fpm startstarting php-fpm done[[email protected] php-fpm]# ps aux |grep php-fpmroot 11303 0.0 0.4 123048 4936 ? Ss 21:20 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf) php-fpm 11304 0.0 0.4 123048 4700 ? S 21:20 0:00 php-fpm: pool wwwphp-fpm 11305 0.0 0.4 123048 4700 ? S 21:20 0:00 php-fpm: pool wwwphp-fpm 11306 0.0 0.4 123048 4700 ? s 21:20 0:00 php-fpm: pool wwwphp-fpm 11307 0.0 0.4 123048 4700 ? s 21:20 0:00 php-fpm: pool wwwphp-fpm 11308 0.0 0.4 123048 4704 ? S 21:20 0:00 php-fpm: pool wwwphp-fpm 11309 0.0 0.4 123048 4704 ? s 21:20 0:00 php-fpm: pool wwwphp-fpm 11310 0.0 0.4 123048 4704 ? S 21:20 0:00 php-fpm: pool wwwphp-fpm 11311 0.0 0.4 123048 4704 ? s 21:20 0:00 php-fpm: pool wwwphp-fpm 11312 0.0 0.4 123048 4704 ? s 21:20 0:00 php-fpm: pool wwwphp-fpm 11313 0.0 0.4 123048 4704 ? s 21:20 0:00 php-fpm: pool wwwphp-fpm 11314 0.0 0.4 123048 4704 ? s 21:20 0:00 php-fpm: pool wwwphp-fpm 11315 0.0 0.4 123048 4704 ? S 21:20 0:00 php-fpm: pool wwwphp-fpm 11316 0.0 0.4 123048 4704 ? s 21:20 0:00 php-fpm: pool wwwphp-fpm 11317 0.0 0.4 123048 4704 ? S 21:20 0:00 php-fpm: pool wwwphp-fpm 11318 0.0 0.4 123048 4708 ? S 21:20 0:00 php-fpm: pool wwwphp-fpm 11319 0.0 0.4 123048 4708 ? S 21:20 0:00 php-fpm: pool wwwphp-fpm 11320 0.0 0.4 123048 4708 ? s 21:20 0:00 php-fpm: pool wwwphp-fpm 11321 0.0 0.4 123048 4708 ? s 21:20 0:00 php-fpm: pool wwwphp-fpm 11322 0.0 0.4 123048 4708 ? s 21:20 0:00 php-fpm: pool wwwphp-fpm 11323 0.0 0.4 123048 4708 ? S 21:20 0:00 php-fpm: pool wwwroot 11325 0.0 0.0 112664 972 pts/0 R+ 21:21 0:00 grep --color=auto php-fpm
This article is from the "Gorilla City" blog, please be sure to keep this source http://juispan.blog.51cto.com/943137/1954974
lnmp-installing MySQL and PHP