CentOS 7 min Compile and install php5.6+nginx1.7.5 notes

Source: Internet
Author: User
Tags curl openssl gmp

CentOS 7 min Compile and install php5.6+nginx1.7.5 notes

1, install MySQL please refer to centos 7 min Compile and install mysql5.6.20 notes

2. Compile and install php5.6+nginx1.7.5

2.1, Installation php5.6.0

Add dependent Apps first
Yum install-y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-de Vel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses Curl Openssl-devel Gdbm-devel db4-devel libxpm-devel libx11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c XMLR Pc-c-devel

Install the Encryption Extension Library
cd/usr/local/src/
wget libmcrypt-2.5.8.tar.gz
Tar zxvf libmcrypt-2.5.8.tar.gz
CD libmcrypt-2.5.8
./configure
Make
Make install

CD.. /

wget http://cn2.php.net/distributions/php-5.6.0.tar.gz
Tar zxvf php-5.6.0.tar.gz
CD php-5.6.0

./configure--prefix=/usr/local/php-5.6.0--with-mysql=/usr/local/mysql--with-mysql-sock--with-mysqli=/usr/local /mysql/bin/mysql_config--enable-fpm--with-ncurses--enable-soap--with-libxml-dir--with-XMLrpc--with-openssl-- With-mcrypt--with-mhash--with-pcre-regex--with-sqlite3--with-zlib--enable-bcmath--with-iconv--with-bz2-- Enable-calendar--with-curl--with-cdb--enable-dom--enable-exif--enable-fileinfo--enable-filter--with-pcre-dir-- Enable-ftp--with-gd--with-openssl-dir--with-jpeg-dir--with-png-dir--with-zlib-dir  --with-freetype-dir-- Enable-gd-native-ttf--enable-gd-jis-conv--with-gettext--with-gmp--with-mhash--enable-json--enable-mbstring-- Disable-mbregex--disable-mbregex-backtrack--with-libmbfl--with-onig--enable-pdo--with-pdo-mysql--with-zlib-dir --with-pdo-sqlite--with-readline--enable-session--enable-shmop--enable-simplexml--enable-sockets-- Enable-sqlite-utf8--enable-sysvmsg--enable-sysvsem--enable-sysvshm--enable-wddx--with-libxml-dir  --with-xsl--enable-zip--enable-mysqlnd-compression-support--with-pear

Make && make install

Build complete.
Don ' t forget to run ' make test '.

Cp/usr/local/php-5.6.0/etc/php-fpm.conf.default php-fpm.conf
Duplicate a copy and rename it


/USR/LOCAL/PHP-5.6.0/SBIN/PHP-FPM
Start PHP-FPM


Modify the FPM configuration file php-fpm.conf
Pm.max_children = 50
Pm.start_servers = 20
Pm.min_spare_servers = 5
Pm.max_spare_servers = 35
Pm.max_requests =
Remove semicolon

Ln-s/USR/LOCAL/PHP-5.6.0/SBIN/PHP-FPM/BIN/PHP-FPM
Cp/usr/local/src/php-5.6.0/php.ini-producsion/usr/local/php-5.6.0/lib/php.ini


This php-fpm installation is complete

===================================================================================
2.2, Installation nginx1.7.5
wget http://nginx.org/download/nginx-1.7.5.tar.gz


Useradd www
#添加www Nginx Running Account

Usermod-s/sbin/nologin-g www www
#将www加入www组并禁止www登录shell

Tar zxvf nginx-1.7.5.tar.gz
CD nginx-1.7.5
./configure--prefix=/usr/local/nginx--user=www--group=www--with-http_stub_status_module--without-http_rewrite_ Module--with-http_ssl_module--with-pcre


Make && make install

/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
#启动nginx, Nginx started successfully.


/usr/local/nginx/sbin/nginx-s Reload
Ln-s/usr/local/nginx/sbin/nginx/usr/sbin/nginx

Next, modify the Nginx configuration file,according toneed to modify the corresponding file
Vim nginx.conf

user nobody;#去掉前面

According to the include Fastcgi_params;
Vim Fastcgi_params

Add the following to save
Fastcgi_param script_filename $document _root$fastcgi_script_name;
#否则nginx不能找到php文件进行解析


Nginx-s Reload
Nginx Restart

nginx installation ends.

CentOS 7 min Compile and install php5.6+nginx1.7.5 notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.