Configuration of the PHP development environment (install Apache and PHP on the Linux platform)
Configuration of the PHP development environment (install Apache and php on the Linux platform ):
Download Apache Plugin), download Apache installation-Related Files: apr(apr-1.5.2.tar.gz?、apr-util(apr-util-1.5.4.tar.gz), pcre (pcre-8.10.zip)
(1) install Apache: You must install apr, apr-util, and pcre before installing apache. Otherwise, an error occurs:
Install apr:
Gunzip apr-1.5.2.tar.gz
Tar xvf apr-1.5.2.tar
Go to the apr-1.5.2 directory and execute:
./Configure -- prefix =/usr/local/apr
Make & make install
Install apr-util:
Decompress the package and enter the apr-util directory. Then run the following command:
./Configure -- prefix =/usr/local/apr-util -- with-apr =/usr/local/apr/bin/apr-1-config
Make & make install
Install pcre: Install gcc before installation; otherwise, the pcre file cannot be compiled.
Install gcc: yum-y install gcc + gcc-c ++
Then install pcre:
Decompress the package and enter the pcre directory. Then execute:
./Configure -- prefix =/usr/local/pcre
Make & make install
After these files are installed, you can install apacheto decompress httpd-2.4.12.tar.gz:
Gunzip httpd-2.4.12.tar.gz
Tar xvf httpd-2.4.12.tar
Go to the extract Directory: cd httpd-2.4.12 and execute:
. /Configure -- prefix =/usr/local/apache -- enable-so -- with-apr =/usr/local/apr -- with-apr-util =/usr/local/apr- util \
-- With-pcre =/usr/local/pcre
Make & make install
(2) install PHP:
Install libxml2 before installing php:
Decompress the package and enter the Directory: libxml2-2.7.8, and then execute:
./Configure -- prefix =/usr/local/libxml2
Make & make install
Install php: unzip and enter the directory php-5.6.9, and then execute:
./Configure -- prefix =/usr/local/php -- with-libxml-dir =/usr/local/libxml2 -- with-apxs2 =/usr/local/apache/bin/apxs
Make & make install
After installing php, copy the php. ini-development in the unzipped php-5.6.9 directory to the following directory:
Cp php. ini-development/usr/local/php/lib/php. ini
(3) Configure httpd-conf In the conf folder of Apache and add the following content (if it does not exist ):
Add LoadModule php5_module module/libphp5.so to LoadModule
Add AddType application/x-httpd-php. php at AddTypeapplication
(4) Start or restart Apache:
/Usr/local/apache/bin/apachectl restart (or start)
(5) test whether Apache and PHP are correctly installed:
Go to the htdocs directory in Apache,
[Root @ Masterpc htdocs] # vim hello. php
Echo "Hello world! ";
Phpinfo ();
?>
Enter http: // 172.16.2.42/hello. php In the browser (the IP address of my linux host is 172.16.2.42, which is accessed remotely: