1.编译安装
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
报错:mcrypt.h
需要安装libmcrypt(版本至少在3.5.6以上),而且DVD1中未发现
下载libmcrypt编译安装再执行,如果还是发现不了,可以选择--prefix=/usr/local/libmcrypt选项,然后配置PHP时设置--with-mcrypt=/usr/local/libmcrypt
make --quiet
make install
2.配置PHP
cp php.ini-production /usr/local/php/etc/php.ini
3.修改httpd.conf
apache结合php
Apache主配置文件为:/usr/local/apache2/conf/httpd.conf
vim /usr/local/apache2/conf/httpd.conf
找到:
AddType application/x-gzip .gz .tgz
在该行下面添加:
AddType application/x-httpd-php .php
找到:
<IfModule dir_module> DirectoryIndex index.html </IfModule>
将该行改为:
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>
找到:
#ServerName www.example.com:80
修改为:
ServerName localhost:80