Apache整合PHP
更新:HHH   时间:2023-1-7


前提:已源码安装过Apache


1.安装PHP之前安装PHP组件 GD 库

freetype、jpegsrc、libpng、GD2


(1).安装freetype

tar zxvf freetype-2.3.10.tar.gz

cd freetype-2.3.10

./configure --prefix=/usr/local/freetype

make && make install


(2).安装jpeg    (yum install zlib*)

tar zxvf jpegsrc.v8.tar.gz

cd jpeg-8

./configure --prefix=/usr/local/jpeg

make && make install


(3).安装libpng

tar zxvf libpng-1.2.41.tar.gz

cd libpng-1.2.41

./configure --prefix=/usr/local/libpng

make && make install



2.安装GD2

ln -s /usr/local/libpng/include/pngconf.h /usr/include/

ln -s /usr/local/libpng/include/png.h /usr/include/

tar zxvf gd-2.0.35.tar.gz

cd gd-2.0.35

./configure --prefix=/usr/local/gd2 \

--with-freetype=/usr/local/freetype \

--with-png=/usr//local/libpng \

--with-jpeg=/usr/local/jpeg

make && make install



3.安装PHP (yum install libxml2*)

tar zxvf php-5.2.11.tar.gz

cd php-5.2.11

./configure --prefix=/usr/local/php \

--with-gd=/usr/local/gd2 \

--with-apxs2=/usr/local/apache/bin/apxs \

--with-freetype-dir=/usr/local/freetype \

--enable-mbregex \

--enable-bcmath \

--with-mysql \

--with-zlib-dir \

--enable-mbstring=all \

--with-pdo-mysql


提供配置文件:

cp php.ini-dist /usr/local/php/etc/php.ini



4.修改Apache配置文件

AddType application/x-httpd-php .php



5.检查Apache配置文件

/usr/local/apache/bin/apachectl-t



6.提供测页面并测试

cd /usr/local/apache/htdocs

vim test.php

<?

    phpinfo();

?>

http:// 192.168.10.1/test.php


返回web开发教程...