Following the previous article MySQL, this chapter is about how to deploy PHP services.
Third, PHP installation 1. First install the GD library and the GD Library Association program (used to process and generate pictures).
Yum install \
Libjpeg-devel \
Libpng-devel \
Freetype-devel \
Zlib-devel \
Gettext-devel \
Libxpm-devel \
Libxml2-devel \
Fontconfig-devel \
Openssl-devel \
Bzip2-devel
2. Unzip and install the GD library to/OPT
tar xzvf gd-2.0.35.tar.gz -C /opt
3. Configure, compile, and install GD
#进入gd目录下
cd/opt/gd/2.0.35
Configuration
./configure--PREFIX=/USR/LOCAL/GD
Compiling and installing
Make && make install
4. Install the PHP package into the OPT directory
tar xjvf /opt/lamp/php-5.4.5.tar.bz2 -C /opt
5. Configure, compile, and install PHP
Go to the PHP directory first
cd/opt/php-5.4.5/
Then configure
./configure \
--prefix=/usr/local/php \
--WITH-APXS2=/USR/LOCAL/APACHE/BIN/APXS \
--WITH-GD \
--with-mysql=/usr/local/mysql \
--WITH-CONFIG-FILE-PATH=/ETC \
--enable-sqlite-utf8 \
--with-zlib-dir \
--with-libxml-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--WITH-TTF \
--with-iconv \
--WITH-OPENSSL \
--with-gettext \
--enable-mbstring \
--ENABLE-GD-NATIVE-TTF \
--enable-gd-jis-conv \
--enable-static \
--enable-zend-multibyte \
--enable-inline-optimization \
--enable-sockets \
--ENABLE-SOAP \
--ENABLE-FTP \
--disable-ipv6
Compiling and installing
Make && make install
6. Optimizing PHP Paths
cp php.ini-production /etc/php.ini
7. Configure Apache to support PHP
vim /usr/local/apache/conf/httpd.conf
Find AddType application/x-gzip gz. tgz below to add the following:
AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps
LoadModule php5_module modules/libphp5.so//Check for presence
DirectoryIndex index.php index.html//Adjust home file settings
8. Restart the HTTPD service
Service httpd Stop
Service httpd Start
9. Create a PHP test page
Go to the Apache directory to write index.html
Enter the following content
<?php
Phpinfo ();
?>
Change index.html to PHP format specifically as
Test
View the contents of the PHP test page, such as
Compiling and installing PHP under Linux environment