在我们的项目中需要接入支付库
composer require yansongda/pay=2.10.2
然后我们在服务器运行代码之后看到报错
Problem 1
- Root composer.json requires yansongda/pay 2.10.2 -> satisfiable by yansongda/pay[v2.10.2].
- yansongda/pay v2.10.2 requires ext-bcmath * -> it is missing from your system. Install or enable PHP's bcmath extension.
Alternatively you can require one of these packages that provide the extension (or parts of it):
Keep in mind that the suggestions are automated and may not be valid or safe to use
- phpseclib/bcmath_compat PHP 5.x-8.x polyfill for bcmath extension
- lumisys/bcmath_compat PHP 5.x/7.x polyfill for bcmath extension
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php.ini
- /etc/php.d/10-opcache.ini
- /etc/php.d/20-bz2.ini
- /etc/php.d/20-calendar.ini
- /etc/php.d/20-ctype.ini
- /etc/php.d/20-curl.ini
- /etc/php.d/20-dom.ini
- /etc/php.d/20-exif.ini
- /etc/php.d/20-fileinfo.ini
- /etc/php.d/20-ftp.ini
- /etc/php.d/20-gd.ini
- /etc/php.d/20-gettext.ini
- /etc/php.d/20-iconv.ini
- /etc/php.d/20-intl.ini
- /etc/php.d/20-mbstring.ini
- /etc/php.d/20-mysqlnd.ini
- /etc/php.d/20-pdo.ini
- /etc/php.d/20-phar.ini
- /etc/php.d/20-posix.ini
- /etc/php.d/20-shmop.ini
- /etc/php.d/20-simplexml.ini
- /etc/php.d/20-sockets.ini
- /etc/php.d/20-sodium.ini
- /etc/php.d/20-sqlite3.ini
- /etc/php.d/20-sysvmsg.ini
- /etc/php.d/20-sysvsem.ini
- /etc/php.d/20-sysvshm.ini
- /etc/php.d/20-tokenizer.ini
- /etc/php.d/20-xml.ini
- /etc/php.d/20-xmlwriter.ini
- /etc/php.d/20-xsl.ini
- /etc/php.d/30-mysqli.ini
- /etc/php.d/30-pdo_mysql.ini
- /etc/php.d/30-pdo_sqlite.ini
- /etc/php.d/30-xmlreader.ini
- /etc/php.d/30-zip.ini
- /etc/php.d/40-igbinary.ini
- /etc/php.d/40-msgpack.ini
- /etc/php.d/50-redis.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-bcmath` to temporarily ignore these required extensions.
Composer提示缺少bcmath扩展的问题,我们缺少bcmath这个扩展 安装bcmath扩展:
sudo yum install php-bcmath
启用扩展:
确保php.ini中包含以下行(通常安装后自动启用):
extension=bcmath
重启Web服务器:
sudo systemctl restart php-fpm nginx
验证扩展是否加载:
php -m | grep bcmath
如果输出bcmath,说明已启用。
到这里说名我们问题已经解决了。
本文为谷永庆原创文章,转载无需和我联系,但请注明来自luffy博客http://gyqtt.cn
Recent Comments