PHP source code compilation and installation-php Tutorial

Source: Internet
Author: User
PHP source code compilation and installation simple arrangement PHP source code compilation and installation configuration

Http://php.net/downloads.php


Pre-installed dependencies in CentOS. you can add dependencies by yourself. Generally, the following is sufficient.
Yum install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel-y


Add common PHP configurations
./Configure -- prefix =/usr/local/php \
-- With-config-file-path =/usr/local/php/etc -- with-bz2 -- with-curl \
-- Enable-ftp -- enable-sockets -- disable-ipv6 -- with-gd \
-- With-jpeg-dir =/usr/local -- with-png-dir =/usr/local \
-- With-freetype-dir =/usr/local -- enable-gd-native-ttf \
-- With-iconv-dir =/usr/local -- enable-mbstring -- enable-calendar \
-- With-gettext -- with-libxml-dir =/usr/local -- with-zlib \
-- With-pdo-mysql = mysqlnd -- with-mysqli = mysqlnd -- with-mysql = mysqlnd \
-- Enable-dom -- enable-xml -- enable-fpm -- with-libdir = lib64 -- enable-bcmath


Last
Make & make install


Copy the PHP configuration file and the FPM configuration file. the default port of FPM is 9000. Nginx uses this port to proxy the FastCGI module of PHP.
Cp php. ini-production/usr/local/php/etc/php. ini
Cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php-5.5.0/etc/php-fpm.conf


Add the following section to connect to PHP fast cgi in the server section of Nginx. conf:
Location ~ . * \. (Php )? $
{
Expires-1 s;
Try_files $ uri = 404;
Fastcgi_split_path_info ^ (. + \. php) (/. +) $;
Include fastcgi_params;
Fastcgi_param PATH_INFO $ fastcgi_path_info;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
Fastcgi_pass 127.0.0.1: 9000;
}


Test whether the syntax is correct
Nginx-t


Start php-fpm after it is started under the sbin Directory of the php Installation Path
Ps-ef | grep fpm to view the php-fpm information


Start Nginx and Nginx has connected to the fastcgi service provided by php-fpm.

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.