centos6.5 nginx+php+mysql php5.4 Installation

Source: Internet
Author: User
Tags bz2 curl fpm install php mcrypt

I. Pre-installation Preparation

cd/usr/local/src/

Yum-y Install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-deve L LIBXML2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses Ncurses-devel Curl C Url-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel OpenSSL openssl-devel


Two. Install PHP

Download PHP

wget http://cn2.php.net/distributions/php-5.4.38.tar.gz

TAR-ZXVF php-5.4.38.tar.gz

CD php-5.4.38

./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--WITH-GD--with-jpeg-dir

An error occurred at this time: configure:error:mcrypt.h not found. Please reinstall Libmcrypt.

Workaround:

Rpm-ivh "http://www.lishiming.net/data/attachment/forum/month_1211/epel-release-6-7.noarch.rpm"

Yum Install-y libmcrypt-devel

Again

./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--WITH-GD--with-jpeg-dir

Make all Install


cd/usr/local/php

CP Etc/php-fpm.conf.default etc/php-fpm.conf


Vi/usr/local/php/etc/php-fpm.conf

Save after modification:

user = www-php

Group = www-php


Add user

Groupadd www-php

Useradd-g www-php www-php


Compiling Nginx

In the server segment, add:

# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

Location ~ \.php$ {

root HTML;

Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_param script_filename $document _root$fastcgi_script_name;

Include Fastcgi_params;

}

Create a PHP test file

vi/usr/local/nginx/html/index.php

Add the following content:


<?php

Echo Phpinfo ();

?>

~

Start Nginx:

/usr/local/nginx/nginx

Start PHP

/usr/local/php/sbin/php-fpm


Test:

Links 192.168.66.176/index.php where 192.168.66.176 is an IP address


The test results show that the PHP version and other information are OK

centos6.5 nginx+php+mysql php5.4 Installation

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.