CentOS Installation PHP PHP-FPM

Source: Internet
Author: User
Tags fpm install openssl mcrypt zend

1. Download PHP Source Package

http://www.php.net/downloads.php

2. Install PHP

TAR-XVF php-5.5.13.tar.bz2

CD php-5.5.13

./configure--prefix=/usr/local/php--with-config-file-path=/etc--enable-inline-optimization--disable-debug-- Disable-rpath--enable-shared--enable-opcache--enable-fpm--with-fpm-user=www--with-fpm-group=www--with-mysql= Mysqlnd--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd--with-gettext--enable-mbstring--with-iconv--with-mcrypt-- With-mhash--with-openssl--enable-bcmath--enable-soap--with-libxml-dir--enable-pcntl--enable-shmop-- Enable-sysvmsg--enable-sysvsem--enable-sysvshm--enable-sockets--with-curl--with-zlib--enable-zip--with-bz2-- With-readline--without-sqlite3--without-pdo-sqlite--with-pear

Error occurred: Congigure error:xml2-config not found.

Workaround:

Execute command: sudo yum install Libxml2-devel

To see if it was successful: Find/-name "Xml2-config"

Error occurred: Congigure error:cannot find OpenSSL ' s <evp.h>

Workaround:

Yum Install OpenSSL Openssl-devel

Ln-s/usr/lib64/libssl.so/usr/lib/

Error occurred: Configure:error:Please Reinstall the BZIP2 distribution

Workaround: Yum Install bzip2 Bzip2-devel

Error occurred: Configure:error:Please Reinstall the Libcurl distribution-easy.h should be in <curl-dir>/include/curl/

Workaround: Yum-y Install Curl-devel

Configure:error:mcrypt.h not found. Please reinstall Libmcrypt.

sudo yum install libmcrypt libmcrypt-devel mcrypt Mhash

Configure:error:Please Reinstall Readline-i Cannot find readline.h
sudo yum install Readline-devel

Make

Make install

If prompted make: * * [Ext/fileinfo/libmagic/apprentice.lo] Error 1. /configure after adding--disable-fileinfo, again./configure.

If make : [sapi/cli/php] Error 1 Modify makefile in extra_libs = Last add-liconv and then re-make again.

Adding PHP commands to environment variables

Vim/etc/profile

Join at the end

Path= $PATH:/usr/local/php/bin

Export PATH

To make the change take effect immediately execution

. /etc/profile or Source/etc/profile

View environment variables

Echo $PATH

View PHP Version

Php-v

PHP 5.5.13 (CLI) (Built:jun 20 2014 11:11:26)
Copyright (c) 1997-2014 the PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

Configure PHP-FPM

Cd/usr/local/php/etc

CP Php-fpm.conf.default php-fpm.conf

Start PHP-FPM

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

Modify Nginx configuration file (/etc/nginx/conf.d/default.conf)

Location/{

root Web directory;

Index index.html index.htm index.php;

}

Location ~ \.php$ {

root HTML;

Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_param script_filename Web root directory $fastcgi_script_name;

Include Fastcgi_params;

}

Re-start Nginx

/etc/init.d/nginx restart

Create a index.php under the Web root directory

<?php echo phpinfo ();?>

Enter http://ip/index.php in the browser to see the success.

Note: Modify the Web root directory according to your own configuration, as my/usr/share/nginx/html.

If the startup PHP-FPM error occurs: Can not get uid for WWW, modify php-fpm.conf user to Nginx Group for Nginx

CentOS Installation PHP PHP-FPM

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.