Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP编译:关闭未定义_Php_Compiler Errors_Undefined_Configure - Fatal编程技术网

PHP编译:关闭未定义

PHP编译:关闭未定义,php,compiler-errors,undefined,configure,Php,Compiler Errors,Undefined,Configure,只是一个简单的问题:我想编译PHP 7.1.6,并在执行配置脚本时遇到以下问题: checking size of short... (cached) 2 checking size of int... (cached) 4 checking size of long... (cached) 8 checking size of long long... (cached) 8 checking size of off_t... 0 configure: error: off_t undefine

只是一个简单的问题:我想编译PHP 7.1.6,并在执行配置脚本时遇到以下问题:

checking size of short... (cached) 2
checking size of int... (cached) 4
checking size of long... (cached) 8
checking size of long long... (cached) 8
checking size of off_t... 0
configure: error: off_t undefined; check your library configuration
以下是我的配置选项:

./configure --prefix=/usr/local/php --disable-all --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-pdo --with-pdo-mysql=/usr/local/mysql --with-zlib=/usr/local --with-zlib-dir=/usr/local --with-ldap=/usr/local --with-curl=/usr/local --with-openssl=/usr/local/ssl --with-libxml-dir=/usr/local --with-iconv=/usr/local --with-iconv-dir=/usr/local --with-pcre-regex=/usr/local --with-pcre-dir=/usr/local --enable-filter --disable-debug --enable-inline-optimization --disable-rpath --disable-static --enable-session --enable-dom --enable-json --enable-ctype --enable-hash --enable-tokenizer --enable-xmlreader --enable-shared --enable-xml --enable-libxml --enable-simplexml --with-pic --enable-bcmath --with-gd --with-freetype-dir=/usr/local --with-png-dir=/usr/local --with-jpeg-dir=/usr/local --enable-gd-native-ttf --enable-mbstring --enable-zip --enable-intl --enable-soap --enable-exif

也许你们中有人给了我一些提示?

我的解决方案就是从libzip源代码中复制/usr/local/include/中的“zipconf.h”
此文件丢失。

我发现问题是由于LD_library_PATH环境变量中缺少libzip库位置所致。在我的例子中,我添加了lib子文件夹,而实际的库安装在lib64下。添加正确的路径解决了问题。

libzip版本与php版本不兼容。在编译php7.3时使用最新版本的libzip会有这个问题,降级也可以

wget https://nih.at/libzip/libzip-1.2.0.tar.gz
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make && make install
可能还有另一个问题: h:没有这样的文件或目录

试一试

…然后/

    $ autoreconf ./configure.ac
……最后

    $ ./configure
这为我解决了同样的问题。如果从源代码处安装了libzip,则可能必须在/usr/lib64上运行ldconfig


在发表上述文章一年多后,我又遇到了这个问题,因此这进一步澄清了我的机器的解决方案。在我的例子中,我试图用比当时CentOS上可用的RPM更新的libzip版本编译PHP7.3。我也必须从源代码编译libzip。在我的例子中,HTTPD、PHP和libzip的构建都安装在/usr/local子目录中。我能够通过执行以下操作来构建PHP:

echo '/usr/local/lib64
>/usr/local/lib
>/usr/lib
>/usr/lib64'>>/etc/ld.so.conf
ldconfig -v
然后从我的生成目录:

./config.nice
make
make install
上面关于将我的本地目录添加到我的动态库配置的提示来自以下帖子:

在我的配置(PHP 7.3.7和Centos 7.6.1810)中,解决方案是Anastas Giokov的响应和kkuhrman的响应的混合:

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PHP_DIR/build-src/srclib/libzip-1.2.0/lib"


对于我来说,
libzip 1.2.0
无法编译,
1.4.0
工作正常。(在CentOS 7.3上安装
PHP7.3.4
)在上一篇文章发表一年多后,我又遇到了这个问题。在我的例子中,我试图用比当时CentOS上可用的RPM更新的libzip版本编译PHP7.3。我也必须从源代码编译libzip。在我的例子中,HTTPD、PHP和libzip的构建都安装在/usr/local子目录中。我能够通过执行以下操作来构建PHP:
./config.nice
make
make install
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PHP_DIR/build-src/srclib/libzip-1.2.0/lib"
ln -s ../lib/zipconf.h $PHP_DIR//build-src/srclib/libzip-1.2.0/include/zipconf.h