网站制作学习网Linux→正文:linux编译安装php
字体:

linux编译安装php

Linux 2012/5/3 17:40:21  点击:不统计

原载于:转www.载for网站制作学习asp必.cn究

以前都是php采用yum安装的形式,这次采用编译安装,自定义的形式安装php,并对应配置apache。

1.首先解压php
tar -jxvf php......tar.bz2
解压后,进入对应路径
2.安装php
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --with-

jpeg-dir  --with-png-dir --with-zlib-dir --with-freetype-dir --with-mcrypt=/usr/local/libmcrypt/  --with-gd   --

with-curl --with-pcre-dir

出现错误
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
解决错误[root@localhost php-5.3.5]# yum install  libxml2*

出现checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
[root@localhost php-5.3.5]# yum install  libxml2*
解决  yum install curl*

出现错误
checking for floorf... yes
configure: error: libjpeg.(a|so) not found.
解决yum install libjpeg*

出现错误
checking for jpeg_read_header in -ljpeg... yes
configure: error: libpng.(a|so) not found.
解决yum install libpng*


If configure fails try --with-xpm-dir=<DIR>
configure: error: freetype.h not found.
[root@localhost php-5.3.5]# yum install freetype*

出现configure: error: mcrypt.h not found. Please reinstall libmcrypt.
[root@localhost php-5.3.5]# cd ..
上传
安装
./configure --prefix=/usr/local/libmcrypt
make && make install


完毕之后,进行编译
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --with-

jpeg-dir  --with-png-dir --with-zlib-dir --with-freetype-dir --with-mcrypt=/usr/local/libmcrypt/  --with-gd   --

with-curl --with-pcre-dir
然后 make && make install


配置apache 在/usr/local/apache/conf/httpd.conf
添加下面两行
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
在查找index
添加一下index.php

重启apache 用 /usr/local/apache/bin/apachectl restart


原载于:网f站o学a习s制p作.cn

·上一篇:linux 安装apache >>    ·下一篇:php编译动态增加模块 >>
推荐文章
最新文章