Build PHP running environment in the premise of building PHP to build the Apache,mysql to complete. Install PHP package (manually compiled installation) 1: Install GD Library and GD Library affiliate Program//to process and generate pictures//
[[email protected] lamp]# yum install > libjpeg-devel > libpng-devel > freetype-devel > zlib-devel > gettext-devel > libXpm-devel > libxml2-devel > fontconfig-devel > openssl-devel > bzip2-devel -y
2: Unzip the GD library and compile
[[email protected] lamp] tar zxvf /opt/lamp/gd-2.0.35.tar.gz -C /opt/[[email protected] lamp] cd ../gd/2.0.35/[[email protected] 2.0.35] ./configure --prefix=/usr/local/gd[[email protected] 2.0.35] make && make install
3: Unzip the PHP source code package and install the compilation
[[email protected] php-5.5.38] tar zxvf /opt/lamp/php-5.5.38.tar.gz -C /opt/[[email protected] php-5.5.38] ./configure > --prefix=/usr/local/php > --with-apxs2=/usr/local/httpd/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[[email protected] php-5.5.38] make && make install
4: Let Apache support PHP
#找到 AddType application/x-gzip .gz .tgz 在下面添加如下内容[[email protected] ~] vim /usr/local/apache/conf/httpd.conf AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps# 搜索php5有没有下面这个配置 LoadModule php5_module modules/libphp5.so# 找到这个标签在index.html后面加入index.php<IfModule dir_module> DirectoryIndex index.html index.php</IfModule>
Restarting the HTTPD service
[[email protected] ~] systemctl restart httpd.service
Join the PHP test page
[[email protected] ~] cd /usr/local/httpd/htdocs/[[email protected] htdocs] lsindex.html[[email protected] htdocs] vim index.html
PHP is built after the Apache Web page optimization, you can first try to build a forum next blog will talk about building a simple forum below open the Web testIf you have no access to see if the firewall is off
Build PHP Runtime Environment