存档在 ‘【技术】’ 分类

error unsupported size of off_t

2017年8月7日

在编译安装PHP的时候,进行 make 时出现了编译错误:

In file included from /home/data/php-7.1.8/ext/zip/lib/zip_add.c:36:0:
/home/data/php-7.1.8/ext/zip/lib/zipint.h:126:2: error: #error unsupported size of off_t
 #error unsupported size of off_t
  ^
make: *** [ext/zip/lib/zip_add.lo] Error 1

参考:https://bugs.php.net/bug.php?id=68302

执行命令:

export CFLAGS="-L/opt/xml2/lib"

然后清除上一次编译的错误:

make clean

重新 configure 和 make 。

mod_ssl.so: undefined symbol: SSL_get_srp_userinfo

2017年8月4日

如果需要支持http2,就要求高于OpenSSL的版本高于1.0.1,也就只能编译安装OpenSSL,然后编译安装Apache。

目前最新版是Apache 2.4.27 (2017-07-11)。

wget http://www-us.apache.org/dist//httpd/httpd-2.4.27.tar.gz && tar -zxvf httpd-2.4.27.tar.gz && cd httpd-2.4.27
export CPPFLAGS="-I/usr/include/openssl" LDFLAGS="-L/usr/lib"
./configure --prefix=/usr/local/apache2 --enable-mods-shared=most --with-crypto --enable-rewrite --enable-headers --enable-deflate --enable-socache-shmcb --enable-negotiation  --enable-ssl --with-ssl=/usr/lib --enable-http2 --with-nghttp2=/usr/local/lib --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make && make install

重点在于设置 CPPFLAGS 和 LDFLAGS 。

如果没有设置或者没有正确设置,会报错:

Cannot load module mod_ssl.so: undefined symbol: SSL_get_srp_userinfo"

参考:https://serverfault.com/questions/587267/upgrade-to-apache-2-4-9-opensssl-error-ssl-get-srp-userinfo
参考:https://superuser.com/questions/912599/apache-error-after-upgrade-cannot-load-module-mod-ssl-so-undefined-symbol-ssl
参考:http://www.linuxquestions.org/questions/linux-server-73/upgrading-apache-to-2-4-9-openssl-error-ssl_get_srp_userinfo-4175500874-print/
参考:http://blog.sina.com.cn/s/blog_78d3277d0102x5l0.html

注意:在重新编译之前,需要清空已编译的文件:

make distclean

参考 configure 的帮助文件:

输入:

./configure --help

输出:

...
Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor

(98)Address already in use: AH00072: make_sock: could not bind to address [::]:443

2017年8月4日

当启动Apache时:

service httpd start

报错:

(98)Address already in use: AH00072: make_sock: could not bind to address [::]:443

可能是443端口被占用,查看进程:

netstat -lnp|grep 443

返回为空。

搜索下解决方案。

参考:http://www.linuxquestions.org/questions/linux-software-2/98-address-already-in-use-make_sock-could-not-bind-to-address-0-0-0-0-443-a-110753/

In my case the problem went away when I commented out

Listen :443

in httpd.conf

My GUESS is Apache was already grabbing this port via a virtual host in another config file, and a second attempt to hold onto it confues good old Apache to such an extent that it would just totally give up.

的确因为我在 httpd.conf 存在 Listen :443 这一行,于是注释掉。再启动就正常了。

怎样编译安装libzip

2017年8月2日

zip格式是使用非常广泛的压缩文件格式。libzip 依赖于 zlib ,而zlib压缩本身主要处理gzip数据流。

Centos7下载安装PHP7时,报错:

configure: error: system libzip must be upgraded to version >= 0.11

参考:http://www.uedbox.com/centos7-ziparchive-libzip/

1. 先卸载原来安装的 libzip

yum remove libzip

2. 编译安装最新版本的 libzip

官网:http://www.nih.at/libzip/index.html

参考:https://gist.github.com/mobius/1759816

最高版本:libzip-1.2.0 (2017-02-19)。

wget http://www.nih.at/libzip/libzip-1.2.0.tar.gz && tar xvf libzip-1.2.0.tar.gz && cd libzip-1.2.0
./configure  --prefix=/usr/local/libzip
make -j && make install

输出:

...
Libraries have been installed in:
   /usr/local/libzip/lib
...

更新系统动态连接库配置:

echo '/usr/local/libzip/lib' >> /etc/ld.so.conf.d/custom-libs.conf
ldconfig

编译安装完成。

可能会碰到so文件找不到的情况。由于为搜索/usr/lib64目录的原因,一般的解决方法就是直接软连接过去。

创建软连接:

ln -vs /usr/local/libzip/include/zipconf.h /usr/local/include

3. 编译安装zip

下载:http://pecl.php.net/package/zip

wget http://pecl.php.net/get/zip-1.14.0.tgz && tar zxvf zip-1.14.0.tgz && cd zip-1.14.0
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install

上面的注意路径问题,路径不对肯定报错,具体看你的环境。同时zip版本可到官方看:http://pecl.php.net/package/zip

怎样编译安装MCrypt

2017年8月2日

第一步:编译安装Libmcrypt

下载:http://sourceforge.net/projects/mcrypt/files/Libmcrypt/

wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && tar -xzvf libmcrypt-2.5.8.tar.gz && cd libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt
make -j && make install

输出:

...
Libraries have been installed in:
   /usr/local/libmcrypt/lib
...

更新系统动态连接库配置:

echo '/usr/local/libmcrypt/lib' >> /etc/ld.so.conf.d/custom-libs.conf
ldconfig

编译安装完成。

第二步:编译安装MCrypt

下载:http://sourceforge.net/projects/mcrypt/files/MCrypt/

wget http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && tar -xzvf mcrypt-2.6.8.tar.gz && cd mcrypt-2.6.8
./configure --prefix=/usr/local/mcrypt --with-libmcrypt=/usr/local/libmcrypt/lib
make -j && make install

输出:

...
rors.o bits.o openpgp.o rndwin32.o environ.o getpass.o ufc_crypt.o popen.o class                                                                                                                     ic.o rfc2440.o gaaout.o   -lz  -lmhash -L/usr/local/lib -lmcrypt
libtool: link: gcc -g -O2 -I/usr/local/include -Wall -o mcrypt extra.o mcrypt.o                                                                                                                      keys.o random.o rndunix.o xmalloc.o functions.o errors.o bits.o openpgp.o rndwin                                                                                                                     32.o environ.o getpass.o ufc_crypt.o popen.o classic.o rfc2440.o gaaout.o  -lz /                                                                                                                     usr/local/lib/libmhash.so -L/usr/local/lib /usr/local/lib/libmcrypt.so
...

更新系统动态连接库配置:

ldconfig

编译安装完成。