Install and configure PHP source code in Linux
Linux: RedHat 6/CentOS 6
Continue with the configuration of Apache in the previous article, and record the process of installing php in Linux below.
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 libxml2
Yum 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:
# [Email protected]/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)
?
1
. /Configure -- prefix =/work/installed/apache -- with-apr =/work/installed/apr -- with-apr-util =/work/installed/apr-util --- 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:
DirectoryIndex index.html
Add: Just add index. php after index.html! (This configuration has been written to Apache in the configuration in the previous note)
DirectoryIndex index.html index. php
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:
In my release directory, the index. php file is created under/home/web /.
If the preceding content is displayed, the test is successful!
PHP 7, you deserve it
Experience PHP 7.0 on CentOS 7.x/Fedora 21
Install LNMP in CentOS 6.3 (PHP 5.4, MyySQL5.6)
Nginx startup failure occurs during LNMP deployment.
Ubuntu install Nginx php5-fpm MySQL (LNMP environment setup)
Detailed php hd scanning PDF + CD source code + full set of teaching videos
Configure the php lnmp development environment in CentOS 6
PHP details: click here
PHP: click here
This article permanently updates the link address: