linux安装PHP: 编译错误整理

本文详细解析了PHP编译过程中遇到的错误信息,包括liblber符号读取失败的问题,并提供了解决方案。同时,针对PHP7编译后未能生成libphp7.so的情况,介绍了如何正确配置以确保PHP与Apache的顺利集成。

1、报错信息如下  /lib64/liblber-2.4.so.2: could not read symbols: Invalid operation

/usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol 'ber_scanf' 
/usr/bin/ld: note: 'ber_scanf' is defined in DSO /lib64/liblber-2.4.so.2 so try adding it to the linker command line 
/lib64/liblber-2.4.so.2: could not read symbols: Invalid operation 
collect2: ld returned 1 exit status 
make: *** [sapi/cli/php] Error 1

解决办法

./configure
vim MakeFile
开头是'EXTRA_LIBS' ,结尾加上 '-llber' ;
执行 make && make test && make install



2、php7编译后没有libphp7.so?

原因:php编译时,没有把扩展模块添加到 apache 中:

解决办法:(可参考另一篇文章: 官方手册

1.检查configure是不是缺少一个 --with-apxs2 ,添加一下
2.然后确认apache2配置文件:apache2.conf或者httpd.conf,配置文件一般在/etc/apache2/...下,中是否含有以下配置:
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
如果有,则进行第3不,不然添加一下
3.重新 ./configure + 参数 make make install 重新安装安装一下,记得加--with-apxs2.


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值