从 centos 上的 src 代码编译 PHP5.5 失败

Compiling PHP5.5 from src code on centos failed

我正在尝试使用其源代码中的 imap 编译 php,但是 运行 以下 configure 命令:

./configure    \
--prefix=/opt/php5   \
--with-config-file-path=/opt/php5/etc   \
--with-config-file-scan-dir=/opt/php5/etc/php.d   \
--with-curl   \
--with-gd   \
--with-jpeg-dir=/usr/lib64   \
--with-png-dir   \
--with-xpm-dir   \
--with-freetype-dir  \
--with-t1lib   \
--with-mcrypt   \
--with-mhash   \
--with-mysql   \
--with-mysqli   \
--with-pdo-mysql \
--with-openssl   \
--with-xsl   \
--with-bz2   \
--with-gettext   \
--with-pear   \
--with-zlib   \
--enable-exif  \
--enable-wddx   \
--enable-bcmath  \
--enable-calendar \
--enable-ftp   \
--enable-mbstring   \
--enable-soap   \
--enable-sockets   \
--enable-shmop   \
--enable-dba   \
--enable-sysvmsg  \
--enable-sysvsem   \
--enable-zip   \
--enable-sysvshm   \
--with-libdir=lib64   \
--with-xmlrpc  \
--enable-fpm  \
--with-pdo-oci=instantclient,/usr,12.1   \
--with-imap=/usr/local/imap/imap-2004g/  \
--with-imap-ssl \
--enable-pic \
--with-imap=/usr/local/imap-2004g/lib

它给出以下错误:

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

我为 utf8_mime2text 安装了所有必需的库,但同样的错误不断发生也使解决方案变得疲倦 here

Package uw-imap-devel-2007f-16.el7.x86_64 already installed and latest version

config.log 文件显示这可能是相关的:

configure:47265: checking for utf8_mime2text signature
configure:47287: cc -c -I  conftest.c >&5
cc: fatal error: no input files
compilation terminated.
configure:47287: $? = 4
configure: failed program was:

OS: 分OS 7

有什么建议吗?

从顶部开始:

$ cd /usr/local/
$ wget http://ftp.ntua.gr/pub/net/mail/imap/imap-2007f.tar.gz 
$ tar -xvzf imap-2007f.tar.gz
$ cd /imap-2007f
$ make lrh

imap 现在应该构建...现在调整 ./configure 中的 php 参数:

./configure --prefix=/opt/php5 --with-config-file-path=/opt/php5/etc --with-config-file-scan-dir=/opt/php5/etc/php.d --with-curl --with-gd --with-jpeg-dir=/usr/lib64 --with-png-dir --with-xpm-dir --with-freetype-dir --with-t1lib --with-mcrypt --with-mhash --with-mysql --with-mysqli --with-pdo-mysql --with-openssl --with-xsl --with-bz2 --with-gettext --with-pear --with-zlib --enable-exif --enable-wddx --enable-bcmath --enable-calendar --enable-ftp --enable-mbstring --enable-soap --enable-sockets --enable-shmop --enable-dba --enable-sysvmsg --enable-sysvsem --enable-zip --enable-sysvshm --with-xmlrpc --enable-fpm --with-pdo-oci=instantclient,/usr,12.1 --with-fpm-user=www-data --with-fpm-group=www-data --with-imap=/usr/local/imap-2007f/ --with-imap-ssl --enable-pic --with-libdir=/usr/local/imap-2007f/lib/

If you receive an error in config.log such as:

make: *** No rule to make target /usr/local/src/php-5.5.38/ext/imap/php_imap.c', needed by ext/imap/php_imap.lo'. Stop.

您可能缺少上述目录中的 php_imap.c 文件。解决后,您应该能够使用 imap.

成功构建 php

我通过执行以下操作解决了这个问题:

1- 为 imap 创建新目录

mkdir /usr/local/imap 

2- 从 here 下载的 client-c 在创建的目录中:

wget http://ftp.ntua.gr/pub/net/mail/imap/c-client.tar.gz

3- tar 下载文件:

tar -xvzf c-client.tar.gz 

4- 在内部创建目录 imap-227f 创建两个新目录,如下所示:

mkdir lib
mkdir include

5-转到c-client源代码

cd imap-2007f/src/c-client/

6- 将所有 *.h 文件复制到 include/ 并将所有 *.c 文件复制到 lib/

cp *.h /usr/local/imap/imap-2007f/include/
cp *.c /usr/local/imap/imap-2007f/lib/

7- 转到 php 内的 imap ext 目录,在我的例子中是:

cd /usr/local/src/php-5.5.38/ext/imap

8-做phpize

9- 为 centos 安装 imap-devel

sudo yum install uw-imap-devel

10- 通过执行配置:

./configure --with-libdir=lib64  --with-kerberos --with-imap-ssl 

11-做make

12- make 后,它会将目录提供给 imap.so 扩展名,如果没有,请执行:

find / -name imap.so

13-执行php -i | grep extension_dir找到php的扩展目录,然后将编译后的扩展复制到该目录:

cp .libs/imap.so /opt/php5/lib/php/extensions/no-debug-non-zts-20121212/

14-做php -i | grep 'Configuration File'找到加载的php.ini,然后将新的编译扩展添加到它extension=imap.so

nano /opt/php5/etc/php.ini 
add: extension=imap.so

15- restart php, 对于 php-fpm:

/etc/init.d/php-fpm restart

在这种情况下,您将克服以下两个错误:

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL
configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.