Lamp Server Environment compilation (partial) installation-php fastcgi mode

Source: Internet
Author: User
Tags phpinfo

Environment:

redhat5.8 (2.6.18-194.el5.i386,_)

APACHE-HTTPD 2.4.16

MysQl mysql-5.6.25 Binary Universal Package

PHP php-5.6.11

pcre-8.35

XCache 3.2

Installation Order:

Apr-->apr-util-->httpd-->mysql-->php-->xcache

Installing the HTTPD service and MySQL in another article is described in detail and is no longer described here. It is important to note that the version of the HTTPD service above 2.4 requires more than pcre8.0 version support. Install the Pcre RPM installation package before compiling and installing the httpd.

Compile and install fastaphp:

Go to unzip directory straight line:./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-openssl--with-mysqli=/usr/ Local/mysql/bin/mysql_config--enable-mbstring--with-preetype-dir--with-jpeg-dir--with-zlib--with-libxml-dir=/ usr--enable-xml--enable-sockets--enable-fpm--with-mcrypt--with-config-file-path=/etc--with-config-file=/etc/ PHP.D--with-bz2

This is different from compiling and installing PHP as a httpd module .

--with-apxs2=/usr/local/apache/bin/apxs parameter, the meaning of this parameter is to compile PHP into a httpd module. Here is the FASTCGI model. Remove the parameter.

Make &&make Install

Configuring the PHP-FPM Service

[Email protected] php-5.6.11]# pwd

/root/php-5.6.11

Copy the SYSV service script

CP SAPI/FPM/INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM

chmod +x/etc/init.d/php-fpm

Chkconfig--add PHP-FPM

Copy PHP configuration file

CP Php.ini-production/etc/php.ini

Modify the Data directory path

Data =/data (note Data directory permissions)

Provide additional configuration files for PHP

Cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf

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

Configuring HTTPD Service Support FASTCGI

Enable the following two modules

LoadModule Proxy_module modules/mod_proxy.so

LoadModule Proxy_fcgi_module modules/mod_proxy_fcgi.so

Configuring httpd to support PHP files

AddType application/x-httpd-php. php

AddType Application/x-httpd-php-source. Phps

Configure the reverse proxy (central host)

Proxyrequests off

Proxypassmatch ^/(. *\.php) $ fcgi://127.0.0.1:9000/usr/local/apache/htdocs

Test Httpd-php-mysql Connection

vi/usr/local/apache/htdocs/index.php

<?php

$conn =mysql_connect (' localhost ', ' root ', ' passwd ');

if (! $conn)

echo "Could not connet ...";

Else

echo "connectting,,,";

?>

<?php

Phpinfo ();

?>


<?php

Phpinfo ();

?>

In the browser input http://HOST/index.php, the success should output the following content:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6F/F1/wKiom1Wt6NfCYeRwAACjmktCOC4847.jpg "title=" Asas.png "alt=" Wkiom1wt6nfcyerwaacjmktcoc4847.jpg "/>




Lamp Server Environment compilation (partial) installation-php fastcgi mode

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.