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

来源:互联网 发布:tcl 电视控软件 编辑:程序博客网 时间:2024/05/09 22:50

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




原创粉丝点击