手动编译php,centos 6.2 手动编译 apche php 编译

wget http://apache.etoak.com//httpd/httpd-2.2.21.tar.gz

tar xzvf httpd-2.2.21.tar.gz

cd httpd-2.2.21

./configure --enable-so --enable-mods-shared=most

make

make install

vi /usr/local/apache2/conf/httpd.conf #编辑配置文件

找到:#ServerName www.example.com:80

修改为:ServerName localhost:80

找到:DirectoryIndex index.html

修改为:DirectoryIndex index.html index.php

找到:Options Indexes FollowSymLinks

修改为:Options FollowSymLinks #不显示目录结构

增加

SetHandler application/x-httpd-php

cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd

vi /etc/init.d/httpd

在文件最前面插入下面的行,使其支持chkconfig命令:

#!/bin/sh

# chkconfig: 2345 85 15

# description: Apache is a World Wide Web server.

(注:在运行级2/3/4/5中加入服务,启动顺序85,停止顺序15)

chkconfig --add httpd

service htpd start

yum install mysql-devel

yum install libpng-devel

yum install libjpeg-devel

yum install libxml2-devel

wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download

tar xzvf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure

make

make install

//wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

//tar xzvf libiconv-1.14.tar.gz

//cd libiconv-1.14

//./configure

//make

//make install

wget http://museum.php.net/php5/php-5.1.6.tar.gz

tar xzvf php-5.1.6.tar.gz

cd php-5.1.6

./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-gd --with-xlib --with-mysqli --with-jpeg-dir=/usr/lib/jpeg --with-zlib-dir=/usr/lib/zlib

//--with-mcrypt

make

编译出错  ext/mysqli/mysqli_api.c:145: error: 'gptr' undeclared (first use in this function)

处理  ext/mysqli/mysqli_api.cand replace all occurrances of gptrwith char*

make install

编辑 httpd.conf 文件以调用 PHP 模块。LoadModule 表达式右边的路径必须指向 系统中的 PHP。以上的 make install 命令可能已经完成了这些,但务必要检查。 LoadModule php5_module modules/libphp5.so

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

PHP扩展mcrypt编译时提示:configure: error: *** libmcrypt was not found

需要安装libmcrypt+mhash+mcrypt

全部编译安装,安装到mcrypt的时候出现了问题

./config

checking for libmcrypt - version >= 2.5.0... no

*** Could not run libmcrypt test program, checking why...

*** The test program compiled, but did not run. This usually means

*** that the run-time linker is not finding LIBMCRYPT or finding the wrong

*** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you'll need to set your

*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point

*** to the installed location  Also, make sure you have run ldconfig if that

*** is required on your system

***

*** If you have an old version installed, it is best to remove it, although

*** you may also be able to get things to work by modifying LD_LIBRARY_PATH

***

configure: error: *** libmcrypt was not found

解决方法如下:运行 export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

然后make ; make install

完成

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值