本篇内容介绍了“php和apache编译安装方法”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
一.下载和环境准备
1.Php:wget http://cn2.php.net/distributions/php-5.3.29.tar.bz2
2.libiconv 库:wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
3.安装必要的依赖和库
A.查rpm包
[root@server tools]# rpm -qa zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel
建议:安装CentOS时.勾上组件 x software development 或者yum groupinstall "x software development"
B.以下5个库必需要有
[root@oldboy tools]# rpm -qa zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel
freetype-devel-2.2.1-21.el5_3
zlib-devel-1.2.3-3
libjpeg-devel-6b-37
libpng-devel-1.2.10-7.1.el5_3.2
libxml2-devel-2.6.26-2.1.2.8
二.安装步骤:
1.安装libiconv库:提供不同国家字符编码转换函数
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install
2.编译Php
tar xjvf php-5.3.29.tar.bz2
cd php-5.3.29
./configure \
--prefix=/application/php5.3.29 \
--with-apxs2=/application/apache/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-xmlrpc \
--with-openssl \
--with-zlib \
--with-freetype-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-iconv=/usr/local/libiconv \
--enable-short-tags \
--enable-sockets \
--enable-zend-multibyte \
--enable-soap \
--enable-mbstring \
--enable-static \
--enable-gd-native-ttf \
--with-curl \
--with-xsl \
--enable-ftp \
--with-libxml-dir
make && make install
3.软连接 ln -s /application/php5.3.29/ /application/php
4.复制开发版本的配置文件到安装目录下的lib里面
[root@ser200 php-5.3.29]# cp php.ini-development /application/php/lib/php.ini
5.修改 apache的配置文件.让其支持Php
[root@ser200 php-5.3.29]# cd /application/apache/conf
AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps
<IfModule dir_module>
DirectoryIndex index.php index.html index.htm
</IfModule>
User txidc
Group txidc
附增加用户:
[root@ser200 conf]# groupadd txidc
[root@ser200 conf]# useradd -s /sbin/nologin -M -g txidc txidc
“php和apache编译安装方法”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注编程网网站,小编将为大家输出更多高质量的实用文章!