centos7安装php5.6.30可能遇到的问题总结

1、依赖安装提示没有可用的包libmcrypt

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解决方法:安装 libmcrypt
下载地址:https://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download

tar -xzf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure

make && make install

2、找不到opcache库

configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no

解决方法:编辑/etc/ld.so.conf.d/local.conf添加以下语句/usr/local/lib
# vi /etc/ld.so.conf.d/local.conf
/usr/local/lib
# ldconfig //生效
再执行configure,编译通过

3、off_t未定义

checking size of off_t... 0
configure: error: off_t undefined; check your library configuration
解决方法:安装libzip库

# yum install libzip

4、apache没有libphp5.so依赖

源码编译安装php时没有指定--with-apxs2,需要重新安装php,指定--with-apxs2参数,如:--with-apxs2=/usr/local/apache2/bin/apxs,该参数的目的是生成libphp5.so,让apache支持php。

重新编译时会报错:undefined reference to `ts_resource_ex',解决方法:make clean,将之前编译的结果清除

编译完成会生成文件libphp5.so

[root@server modules]# pwd
/usr/local/apache2/modules
[root@server modules]# ls libphp5.so 
libphp5.so
[root@server modules]# 

最后附上编译命令:

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache2/bin/apxs --enable-inline-optimization --disable-debug  --disable-rpath --enable-shared  --enable-opcache --enable-fpm  --with-mysql --with-mysqli  --with-pdo-mysql --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-gd --with-freetype-dir   --with-jpeg-dir   --with-png-dir 
make && make install




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

luffy5459

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值