Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.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 Laravel中缺少BC数学或GMP扩展_Php_Laravel_Ubuntu_Server_Gmp - Fatal编程技术网

Php Laravel中缺少BC数学或GMP扩展

Php Laravel中缺少BC数学或GMP扩展,php,laravel,ubuntu,server,gmp,Php,Laravel,Ubuntu,Server,Gmp,我正在Ubuntu 16.04上的PHP7.2-fpm上运行Laravel5.7.14 我在本地环境中的代码运行正常,但一旦我将其上传到生产服务器,我就会收到以下错误消息:缺少BC Math或GMP扩展。 我已经安装了GMP+BC数学。当我运行命令php-I | grep-ibcmath时,我得到以下结果: /etc/php/7.2/cli/conf.d/20-bcmath.ini, bcmath BCMath support => enabled bcmath.scale => 0

我正在Ubuntu 16.04上的PHP7.2-fpm上运行Laravel5.7.14

我在本地环境中的代码运行正常,但一旦我将其上传到生产服务器,我就会收到以下错误消息:
缺少BC Math或GMP扩展。

我已经安装了GMP+BC数学。当我运行命令
php-I | grep-ibcmath
时,我得到以下结果:

/etc/php/7.2/cli/conf.d/20-bcmath.ini,
bcmath
BCMath support => enabled
bcmath.scale => 0 => 0
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
当我运行
php-m
时,我得到以下结果:

/etc/php/7.2/cli/conf.d/20-bcmath.ini,
bcmath
BCMath support => enabled
bcmath.scale => 0 => 0
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
我多次重新启动服务器并清除了Laravel的缓存,但没有任何变化,我一直收到此错误消息


我错过了什么?如果您需要更多信息,请随时询问。

管理多个PHP版本有时非常麻烦


如果您使用的是类似Linux的系统,并且尝试升级PHP版本,那么有时会在同一系统上出现两个版本。新安装的版本很少(尤其是手动配置了以前的版本时)无法与Web服务器一起使用。就我个人而言,我也经历过升级PHP和让apache使用新版本,但作为模块而不是FPM,因此如果使用apache,您也应该小心,因为FPM和apache的PHP模块也可能有不同的配置

尝试创建一个路由,例如
route::get('info',function(){phpinfo();})
,以确保fpm配置与命令行配置匹配。有时,Web服务器被配置为使用与命令行不同/更旧的PHP版本using@apokryfos你是对的,我真傻。它使用的是PHP7.1而不是7.2。。。我想我已经升级了。无论如何,谢谢你。如果你想让我接受,请回答:-)