Compiling and installing PHP

Source: Internet
Author: User

1, download the decompression Php,config

Tar zxvf php-xxxx./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-openssl--with-mysqlli=/ With-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--enable-sockets--with-apxs2=/usr/ LOCAL/HTTPD/BIN/APXS # #把php添加成apache模块 # #--with-mcrypt # #支持加密 # #--WITH-CONFIG-FILE-PATH=/ETC-- WITH-CONFIG-FILE-SCAN-DIR=/ETC/PHP.D--with-bz2--enable-maintainer-zts

If you want to support fastcgi,

--with-apxs2=/usr/local/httpd/bin/apxs

Change into--ENABLE-FPM


Fix MCrypt look at an article, compile Error 2 times:

Yum install-y libxml2 Libxml2-devel

Yum install-y bzip2 bzip2-devel

Description

1. In order to support the two mpm of the Apache worker or event, the--ENABLE-MAINTAINER-ZTS option is used at compile time.

2, if you use PHP5.3 or above, in order to link the MySQL database, you can specify MYSQLND, so you do not need to install the MySQL or MySQL development package. MYSQLND is available from PHP 5.3 and can be bound to it at compile time (instead of relying on the specific MySQL client library bindings), but it is the default setting starting with PHP 5.4.

#./configure--with-mysql=mysqlnd--with-pdo-mysql=mysqlnd--with-mysqli=mysqlnd



2. Make&&make Install

Procedure omitted


3. Provide configuration files for PHP

There's php.ini-production in the PHP source package.

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


Edit Apache config file httpd.conf, let Apache support PHP


Vim/etc/httpd/httpd.conf

1, add the following two lines

AddType application/x-httpd-php. php

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


2. Locate to DirectoryIndex index.html

Modified to:

DirectoryIndex index.php index.html


Restart httpd

Test PHP

<?phpphpinfo ();? >

Test if PHP is connected to MySQL properly

<?php$con=mysql_connect (' localhost ', ' root ', '), if ($con) echo "success."; else echo "failure ...";? >


Compiling and installing PHP

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.