[Step 3] install and configure a manual package for Linux php, step 3 for linux
Author: wavelet/QQ463431476. Please reprint it!
Linux: redhat 6/centos 6
Continue with the Apache configuration in the previous note: http://www.cnblogs.com/xiaobo-linux/p/4637056.html. Next, record the process of installing php In linux.
Step 1: Install the dependent package libxml2, libxml2-devel
If php is not installed, the following error occurs during php installation:
configure: error: xml2-config not found. Please check your libxml2 installation.
Therefore, install the dependent package with yum:
yum install libxml2yum install libxml2-devel
Step 2: Download and decompress the php installation package and configure php:
: Http://www.php.net/downloads.php
Unzip the installation package:
Tar-zxvf + php package
Go to the decompressed package folder and execute:
./configure --prefix=/work/installed/php --with-apxs2=/work/installed/apache/bin/apxs
Among them: -- 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
Last installed:
Make install
Configuration file:
# Root@php-5.3.16/cp php. ini-development/work/installed/php/lib/php. ini
Copy the php. ini-development in the source code to/usr/local/php/lib/php. ini and rename it php. ini.
Re-execute the following command in the original Apache decompression package: (this note follows the Apache configuration http://www.cnblogs.com/xiaobo-Linux/p/4637056.html of the previous note)
./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 --- pcre =/work/installed/pcre -- enable-module = shared
Add the following parameters. Otherwise, php cannot be used.-enable-module = shared indicates that Apache can dynamically load modules.
Edit and configure files in Apache
Edit the/work/installed/conf/httpd. conf file (the User-Defined installation directory/usr/local/apache/conf/httpd. conf ).
Find:
AddType application/x-compress. Z
AddType application/x-gzip. gz. tgz
Add:
AddType application/x-httpd-php. php
AddType application/x-httpd-php-source. php5
The purpose is to enable Apcche to support PHP
Find:
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
Add: Just add index. php after index.html! (This configuration http://www.cnblogs.com/xiaobo-Linux/p/4637056.html that has been written to Apache in the configuration in the previous note)
<IfModule dir_module>
DirectoryIndex index.html index. php
</IfModule>
Restart apache: restart Apache under the installed apache directory:
/work/installed/apache/bin/apachectl restart
Step 3 test php:
Create a file named index. php In the directory of the published webpage:
By default, a php file index. php is created under apache htdocs, which contains the following content:
<? Php
Phpinfo ();
?>
In my release directory, the index. php file is created under/home/web /.
If the preceding content is displayed, the test is successful!