PHP 5.3.10 + nginx1.0.12 + PostgreSQL 9.1.2 source code compilation

Source: Internet
Author: User
Tags php download php example php source code sapi

Before playing with PHP, you must first set up the server and database. Here, select nginx and PostgreSQL. The method is as follows:

Nginx1.0.12 source code compilation
Http://blog.csdn.net/qzier_go/article/details/7251991

PostgreSQL 9.1.2 source code compilation
Http://blog.csdn.net/qzier_go/article/details/7251957


PHP source code compilation

For dependency problems, see the article first and then ps. Let's continue...

Official PHP Download Page

Http://www.php.net/downloads.php

# Cd/usr/local/src/PHP/

# Wget http://www.php.net/get/php-5.3.10.tar.gz/from/us.php.net/mirror

Decompress the PHP source code:

# Tar-zxvf php-5.3.10.tar.gz

Compile configuration (FastCGI ):

# Cd php-5.3.10

#./Configure \

-- Prefix =/opt/PHP \

-- With-config-file-Path =/opt/PHP/etc \

-- With-iconv-Dir =/opt/PHP/3 rdlibs/libiconv-1.14 \

-- Enable-FPM

# Make & make install


Make test will submit an environment compatibility report.

Start:

# Cd/opt/PHP/etc

# Cp php-fpm.conf.default php-fpm.conf & CD ..

# Sbin/PHP-FPM

Configure nginx for PHP:

server {        listen       80;        server_name  www.example.com;        index  index.html index.htm index.php;        location / {            root   /srv/www;        }        #....... custum        location ~ \.php$ {            root           /srv/www;            fastcgi_pass   127.0.0.1:9000;            fastcgi_index  index.php;            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;            include        fastcgi_params;        }}

#/Opt/nginx/sbin/nginx-s reload

Compile a web test:

# Vi/srv/www/test. php

Then open the browser to test

Http://www.example.com/test.php

-- With-pgsql support is not enabled above, because it is still used for the time being and will be updated later. If you want to add it yourself, you can directly use the following:

# Cd $ php_src_home
#./Configure -- With-pgsql =/path/to/pgsql + add others.

PS:

Dependency problems:

# Yum-y install libxml2 libxml2-develautoconf

Libiconv dependency problems

#Wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

# Tar -zxflibiconv-1.14.tar.gz

# Cd libiconv-1.14

#./Configure -- prefix =/opt/PHP/3 rdlibs/libiconv-1.14/

# Make & make install

# Ls/opt/PHP/3 rdlibs/libiconv-1.14/
1. Ignore libiconv

If libiconv cannot be referenced, modify the makefile of PHP.

] # Vi makefile

In extra_libs
=-Liconv added to the end...
Or:

Zend_extra_libs =-liconv

Or directly set the variable

# Make zend_extra_libs =-liconv

2. Add the libconv installation directory
#/Configure -- With-iconv =/path/to/libiconv
I will add this method later. I tested it in php5.4.10. Although the option in it is -- wtih-iconv-Dir, it is normal that only -- With-iconv is used after the test.

Php-FPM Problems

In fact, if you have any problems, let's take a look...

The tutorials 5.3.10 seem to require the -- enable-FastCGI parameter, but I./configure -- help | grep CGI is not found, according to the news on http://www.php.net/archive/2010.php?id2010-07-22-2


Key enhancements in PHP 5.3.3 include:
Added FastCGI Process Manager (FPM) SAPI.


The FPM has started experimental integration with the result of viewing the parameters. According to the news from http://www.php.net/archive/2011.php?id2011-11-29-1.


PHP-FPM is no longer marked as experimental.


PHP 5.4 RC2 has canceled the lab attribute

Http://php-fpm.org/downloads/

PHP core (PhP 5.3.x <5.3.3)

Method 1 (not recommended ):

# Cd/usr/local/src/PHP/php-5.3.10

# Mv SAPI/FPM. Bak

# SVN Co http://svn.php.net/repository/php/php-src/trunk/sapi/fpm SAPI/FPM

There is an error message, but you can compile it


Method 2:

This is my own PHP 5.3.10-FPM replacement $ (php_src_home)/SAPI/FPM

Applicable to PHP-FPM of php5.3.10

Http://download.csdn.net/detail/qzier_go/4059294click to open the link


Method 3 (recommended ):

I made a patch on GitHub and it was tested to be effective.

Https://github.com/Qzi/webstore

Php-5.3.10-fpm-unofficial-by-Qzi.patch

Https://github.com/Qzi/webstore/wiki

# Sbin/PHP-FPM-V

PHP 5.3.10 (FPM-fcgi) (built: Feb 12 2012 15:47:26) Copyright (c) 1997-2009 the PHP groupzend engine v2.3.0, copyright (c) 1998-2012 Zend Technologies

Reference:

Https://writer.zoho.com/public/6b6a49b6dcbb8205336873dd09e1b3517a451cd1e1176acb29ac6183f6c6c0976db04614eed231e5

Nginx 0.8.x + PhP 5.2.13 (FastCGI) build a web server that is 10 times better than Apache (version 6th)

Http://blog.s135.com/nginx_php_v6/

Related Article

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.