我正在运行Linux Centos7 VPS。在今天之前,我一直在运行PHP 7.0.x 用于我的iOS HTTP2 APNS服务器的PHPASN1和Jose PHP包。一切都运作良好大约一年。
我注意到我不再得到我的APN了,发现它们是 在PHPASN1包中失败,所以我决定用composer更新这两个包。事情似乎安装得很好,但是在各种不起作用的事情之后(我现在都不知道,因为我今天经历了很多次迭代),我现在就在这一点上:
php composer.phar update
我收到以下消息:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- fgrosse/phpasn1 2.0.1 requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
- fgrosse/phpasn1 2.0.1 requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
- Installation request for fgrosse/phpasn1 v2.0.1 -> satisfiable by fgrosse/phpasn1[2.0.1].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
AFAIK,我已经安装了ext-gmp:
rpm -qa | grep gmp
gmp-devel-6.0.0-15.el7.x86_64
gmp-6.0.0-15.el7.x86_64
当更新可用时,我手动编译Apache 2.4.x和PHP 7.0.x.Im 截至今天两者都是最新的。我使用以下代码编译PHP:
./configure --prefix=/opt/php7029 --with-apxs2=/opt/apache/bin/apxs --with-mysqli --enable-shared --enable-session --enable-libxml --enable-pcntl --enable-sysvshm --enable-sysvsem --with-openssl --libexecdir=/usr/libexec --enable-mbstring
--with-config-file-path=/etc
如果我尝试运行推送APNS的PHP脚本,我会得到以下内容:
PHP Fatal error: Uncaught Error: Call to undefined function FG\ASN1\Universal\gmp_init() in /http_src/navee/apns/jwt/vendor/fgrosse/phpasn1/lib/ASN1/Universal/Integer.php:95
Stack trace:
#0 /http_src/navee/apns/jwt/vendor/fgrosse/phpasn1/lib/ASN1/ASNObject.php(222): FG\ASN1\Universal\Integer::fromBinary('0\x81\x93\x02\x01\x000\x13\x06\x07*\x86H\xCE=...', 5)
#1 /http_src/navee/apns/jwt/vendor/fgrosse/phpasn1/lib/ASN1/Construct.php(165): FG\ASN1\ASNObject::fromBinary('0\x81\x93\x02\x01\x000\x13\x06\x07*\x86H\xCE=...', 5)
#2 /http_src/navee/apns/jwt/vendor/fgrosse/phpasn1/lib/ASN1/ASNObject.php(232): FG\ASN1\Construct::fromBinary('0\x81\x93\x02\x01\x000\x13\x06\x07*\x86H\xCE=...', 5)
#3 /http_src/navee/apns/jwt/vendor/spomky-labs/jose/src/KeyConverter/ECKey.php(67): FG\ASN1\ASNObject::fromBinary('0\x81\x93\x02\x01\x000\x13\x06\x07*\x86H\xCE=...')
#4 /http_src/navee/apns/jwt/vendor/spomky-labs/jose/src/KeyConverter/ECKey.php(49): Jose\KeyConverter\ECKey->loadPEM('0\x81\x93\x02\x01\x000\x13\x06\x07*\x86H\xCE=...')
#5 /http_src/nav in /http_src/navee/apns/jwt/vendor/fgrosse/phpasn1/lib/ASN1/Universal/Integer.php on line 95
今天花了一半的时间试图弄清楚没有运气,我在这里张贴以防万一有人可以告诉我要检查什么或如何解决这个问题。 我不是很熟悉composer.phar,只是基础知识,但似乎某个路径没有正确设置。
提前感谢您的帮助!
答案 0 :(得分:0)
感谢@Nico的提示。我不知道它是怎么发生的,但我总是使用的PHP配置行删除了 - with-gmp = 和 - with-curl = 值。一旦ext-gmp问题得到解决,我的卷曲也无法奏效。一旦我修复并重新安装,一切工作都很好。再次感谢!