"Just 3 steps" Linux PHP installation and Configuration Manual security Kit

Source: Internet
Author: User
Tags unpack

Author of wavelet/qq463431476 welcome reprint!

Linux:redhat 6/centos 6

Proceed to the previous note for Apache configuration http://www.cnblogs.com/xiaobo-Linux/p/4637056.html, and then record the Linux installation PHP process below.

First step: Install the dependent package Libxml2,libxml2-devel

If not installed, the following error will occur during the installation of PHP:

Configure:error:xml2-config not found. Please check your LIBXML2 installation.

So first install the dependent package with Yum:

Yum install Libxml2yum install LIBXML2-devel

The second step: download, unzip the PHP installation package, and the configuration of PHP:

: http://www.php.net/downloads.php
Unpack the installation package:

TAR-ZXVF +php Bag

Go to unpack folder to execute:

./configure--prefix=/work/installed/php  --with-apxs2=/work/installed/apache/bin/apxs

Where:--with-apxs2=/work/installed/apache/bin/apxs is installed after the Apache directory here is my installation directory address (depending on your situation)

Then compile:
Make
Test compilation:
Make Test
Final installation:
Make install

Configuration file:

# [Email protected]/CP Php.ini-development/work/installed/php/lib/php.ini
Copy the original php.ini-development in the source code to/usr/local/php/lib/php.ini, and rename it to PHP.ini

Re-execute the following command in the original Apache unpacking package: (This note is immediately followed by the previous note Apache configuration http://www.cnblogs.com/xiaobo-Linux/p/4637056.html)

./configure--prefix=/work/installed/apache--WITH-APR=/WORK/INSTALLED/APR--with-apr-util=/work/installed/ Apr-util--with-pcre=/work/installed/pcre--enable-module=shared

./configure--prefix=/work/installed/apache--WITH-APR=/WORK/INSTALLED/APR--with-apr-util=/work/installed/ Apr-util--with-pcre=/work/installed/pcre--enable-module=shared

To add a later parameter, you cannot use php,-enable-module=shared to indicate that Apache can dynamically load modules

Edit and configure Apache inside files

Edit the/work/installed/conf/httpd.conf file (other people have a custom installed directory/usr/local/apache/conf/httpd.conf
Found it:
AddType application/x-compress. Z
AddType application/x-gzip. gz. tgz
Add in the following:
AddType application/x-httpd-php. php

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

The goal is to enable Apcche to support PHP

Found it:
<ifmodule dir_module>
DirectoryIndex index.html
</IfModule>
Add: Add index.php after index.html! (This has been written to Apache configuration http://www.cnblogs.com/xiaobo-Linux/p/4637056.html in the previous note configuration Apache)
<ifmodule dir_module>
DirectoryIndex index.html index.php
</IfModule>

Restart Apache: Restart in the installed Apache directory:

/work/installed/apache/bin/apachectl restart

The third step is to test PHP:

Create a text index.php file in the directory where you publish the page:


The default is to create a PHP file under Apache Htdocs index.php, which reads as follows:
<?php
Phpinfo ();
?>

My publish directory is to build index.php file under/home/web/

The test succeeds when the content appears as above!

"Just 3 steps" Linux PHP installation and Configuration Manual security Kit

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.