我正在尝试使用 php 7.1.7 和 api 版本 20160303 编译 lampp 套件的 gmp。我下载了gmp-6.1.2.tar.bz2,它用bzip2 -dk gmp-6.1.2.tar.bz2
来
获取tar文件,然后tar -xvvf gmp-6.1.2.tar
然后cd gmp-6.1.2/
。
当我运行/opt/lampp/bin/phpize
时(我正在使用 lampp 套件进行开发),我明白了
Cannot find config.m4.
Make sure that you run '/opt/lampp/bin/phpize' in the top level source directory of the module
我正在尝试为 php7.1.7 编译 gmp。
无需运行/opt/lampp/bin/phpize,并按照以下步骤操作
- ./configure make make
- test
- make install
在控制台上运行php,我得到这个:
PHP Warning: PHP Startup: gmp: Unable to initialize module
Module compiled with module API=20151012
PHP compiled with module API=20160303
These options need to match
in Unknown on line 0
Warning: PHP Startup: gmp: Unable to initialize module
Module compiled with module API=20151012
PHP compiled with module API=20160303
These options need to match
in Unknown on line 0
评论,为了编译特定版本的GMP扩展,您需要克隆PHP-SRC存储库,并编译PHP GMP扩展。
git clone git@github.com:php/php-src.git
您可以克隆目标分支,而不是克隆整个存储库
git clone -b PHP-7.1.7 git@github.com:php/php-src.git --depth 1
然后转到 GMP 扩展目录并 phpize 扩展并完成编译步骤。
cd php-src/ext/gmp
phpize
./configure
make
sudo make install