Build nginx PHP Environment under Linux

Source: Internet
Author: User
Tags install php mcrypt

Download and install the required packages

Openssl-1.0.1i.tar.gz

Zlib-1.2.8.tar.gz

Pcre-8.35.tar.gz

Nginx-1.7.4.tar.gz

Above is nginx dependent file

Libmcrypt-2.5.7.tar.gz

Php-5.3.28.tar.gz

The above is a PHP dependent file

Install in sequence

1. Installing openssl-1.0.1i.tar.gz

[[email protected] mrms]# TAR-ZXVF openssl-1.0.1i.tar.gz[[email protected] mrms]# CD Openssl-1.0.1i.tar.gz[[email Protected] openssl-1.0.1i.tar.gz]#/config [[email protected] openssl-1.0.1i.tar.gz]# make && make install

2. Installing zlib-1.2.8.tar.gz

[[email protected] mrms]# TAR-ZXVF zlib-1.2.8.tar.gz[[email protected] mrms]# CD Zlib-1.2.8[[email protected] zlib-1.2.8 ]#./configure [[email protected] zlib-1.2.8]# make && make install

3. Installing pcre-8.35.tar.gz

[Email protected] mrms]# TAR-ZXVF pcre-8.35.tar.gz[[email protected] mrms]# CD Pcre-8.35[[email protected] pcre-8.35]#. /configure [[email protected] pcre-8.35]# make && make install

4. Installing nginx-1.7.4.tar.gz

[Email protected] mrms]# TAR-ZXVF nginx-1.7.4.tar.gz[[email protected] mrms]# CD Nginx-1.7.4[[email protected] nginx-1. 7.4]#./configure--with-pcre=. /pcre-8.35--with-zlib=. /zlib-1.2.8--with-openssl=. /openssl-1.0.1i[[email protected] nginx-1.7.4]# make && make install

The installation of Nginx is complete!

Step three: Detect if the installation was successful

[Email protected] nginx-1.2.6]# CD  /usr/local/nginx/sbin[[email protected] sbin]#./nginx-t

The following prompt appears indicating that the installation was successful

Start Nginx

[Email protected] sbin]#./nginx

View ports

[Email protected] sbin]# NETSTAT-NTLP

The results are as follows

then install libmcrypt-2.5.7.tar.gz, this file is required to install PHP

Note: Configure:error:mcrypt.h not found. Please reinstall Libmcrypt. This error is caused by libmcrypt

[[email protected] mrms]# TAR-ZXVF libmcrypt-2.5.7.tar.gz[[email protected] mrms]# CD Libmcrypt-2.5.7[[email protected] libmcrypt-2.5.7]#./configure [[email protected] libmcrypt-2.5.7]# make && make install

Finally install PHP

 [[email protected "mrms]# tar-zxvf php-5.3.28 . tar.gz[[email protected] mrms]# cd php-5.3.28  [[email protected]  ]#  ./ Configure--prefix=/home/opt/php--with-config-file-path=/home/opt/php/etc--with-freetype-dir--with-jpeg-dir-- With-png-dir--with-zlib--enable-mbstring--with-mcrypt--with-mhash--enable-fpm--with-gd--enable-gd-native-ttf-- With-curl--with-openssl  [[email protected] php-5.3.28 ]# make && make install  
This PHP will be installed successfully, and then start PHP-FPM.
Next is the configuration Nginx access directory, such as the PHP file can not be run to check the next Fastcgi_param file, I have a situation here, and then I added fastcgi_param script_filename $ Document_root$fastcgi_script_name; it's OK. 

Build nginx PHP Environment under Linux

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.