Missing BC Math or GMP extension in Laravel - php

I am running Laravel 5.7.14 on PHP 7.2-fpm on Ubuntu 16.04.
My code in the local environment was working fine, but once I uploaded it to the production server I got this error message: Missing BC Math or GMP extension.
I have installed both GMP + BC Math. When I run the command php -i | grep -i bcmath I get this:
/etc/php/7.2/cli/conf.d/20-bcmath.ini,
bcmath
BCMath support => enabled
bcmath.scale => 0 => 0
When I run php -m I get this:
[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
I have restarted the server multiple times and cleared Laravel's cache but nothing's changing, I keep getting this error message.
What am I missing here? If you need more info do not hesitate to ask.

Managing multiple PHP versions is sometimes very messy.
If you are on a Linux-like system and try to upgrade PHP versions you sometimes end up with 2 versions on the same system. Not infrequently (especially when you manually have configured the previous version) the newly installed version does not get enabled to use with the webserver. Personally I've also experienced upgrading PHP and getting the apache to use the new version but as a module instead of FPM so you should also be wary of that if you are using apache since again FPM and the PHP module for apache might have different configurations as well.

Related

Missing PHP extensions in local windows 10 Magento Installation

I'm trying install Apache + PHP + Magento2.1 + MySQL in Windows 10.
I've already installed:
Magento-CE-2.1.8_sample_data
Content saved in C\Apache24\htdocs
Apache-2.4.27-Win64-VC15.zip
Directory: C\Apache24
PHP Version 5.6.31 php-5.6.31-Win32-VC11-x64.zip
Directory: C:\PHP
mysql-community-5.7.19 (Msi installer)
In the setup installation (Readiness Check) the follow errors are showed:
PHP Extension curl.
PHP Extension xsl.
PHP Extension intl.
PHP Extension mbstring.
PHP Extension openssl.
PHP Extension gd.
I've already uncomment this extensions in php.ini
I've copied icud?57.dll files in apache root dir.
Can anyone tell me, What can be happening? Thanks!
The PHP modules loaded are:
C:\>cd php
C:\php>php -m
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
ereg
exif
filter
ftp
gd
hash
iconv
intl
json
libxml
mbstring
mcrypt
mhash
mysqli
mysqlnd
odbc
openssl
pcre
PDO
pdo_mysql
Phar
Reflection
session
SimpleXML
SPL
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib
[Zend Modules]
Versions from 5.6.0 to 5.6.4 are not supported. Only php 5 supported are from 5.6.5 and above.
I'd better suggest using php 7 to have better support also for your extensions
Check it better here
Otherwise, check better for the PHP modules you are enabling.
According to this question you have to make sure that all the subsequent modules are enabled, and some are missing in your list.
PDO/MySQL
mbstring
mcrypt
mhash,
simplexml,
curl,
gd2,
ImageMagick 6.3.7 (or later) or both
soap and
add xdebug.max_nesting_level=50000; at php.ini

Call to undefined function pcntl_wifsignaled()

I'm attempting to use the import functionality in mediawiki 1.27.0, but I'm getting the error message:
Call to undefined function pcntl_wifsignaled() in extensions/Scribunto/engines/LuaStandalone/LuaStandaloneEngine.php on line 645
I'm running PHP version 5.6.30 on Ubuntu 14.0.4 with Apache2.4.7. I've followed various bits on information to install pcntl module and to the best of my knowledge the module is operational. phpinfo reports that pcntl is enabled. I have also commented out the line in php.ini regarding disabled_functions. Below are some reports from various bits of Ubuntu to explain the current config.
Any ideas on how to fix this?
Installed php modules:
$ php -me
[PHP Modules]
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
intl
json
ldap
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
XCache
XCache Cacher
XCache Coverager
XCache Optimizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib
Disabled PHP functions:
$ php -i | grep disable_functions
disable_functions => no value => no value

Function utf8_encode undefined

I have Ubuntu 16.04 installed, which comes with PHP 7 by default; but I ended up installing PHP 5.6 as well, and I have apache using 5.6.
When I went to run a project of mine, it told me the following:
PHP Fatal error: Call to undefined function utf8_encode()
I read through a bunch of posts where others have had this issue, and tried installing different extensions; but nothing has helped.
My understanding, was that that function would be packed with PHP (4,5,7) by default.
Any ideas?
* Update *
I did try the following, and it came back false.
var_dump(is_callable('utf8_encode'));
Here are the installed mods/extensions:
[PHP Modules]
calendar
Core
ctype
date
dom
ereg
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zlib
[Zend Modules]
Zend OPcache
on ubuntu :
sudo apt-get install php5.6-xml
sudo service apache2 restart
The following fixed it:
sudo a2enmod xml2enc
On FreeBSD try this command
pkg install php71-tokenizer-7.1.25 php71-zlib-7.1.25

Unable to find Mongo class in Connection.php Symfony 2

This is quite an often occurring error, but since I tried a lot of stuff to fix it, I'm kind of getting out of the ideas.
I have a symfony 2 with mongo DB. I have set up my composer.json file to download doctrine-mongo and doctrine-mongo-bundle,
"doctrine/mongodb-odm": "1.0.*#beta",
"doctrine/mongodb-odm-bundle": "3.0.*#beta",
In order to download this 2 modules, I needed to have mongo extension installed into PHP. I have both of them, mongo and mongodb, installed via brew
brew install php56-mongo
brew install php56-mongodb
I believe I have mongo extensions allowed as well, since when I write
php -m
I get this results
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
ldap
libxml
mbstring
mhash
mongo
mongodb
mysql
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib
and you can see mongo there.
Also php -i returns info that mongo is enabled.
But when I'm trying to hit app_dev.php file in my project, I still get this:
ClassNotFoundException in Connection.php line 284: Attempted to load
class "Mongo" from the global namespace. Did you forget a "use"
statement?
I'm using a Mac OS X and have chmod 777 on
app/logs
app/cache
web/
recursively.
Do you have any idea what can trigger this ?
Thank you.
PHP Cli and fpm/apache doesn't use the same configuration, which means your php -m may be not accurate.
What you can do is call http://php.net/manual/en/function.extension-loaded.php inside your php entry point file on your server and make sure its loaded. Restarting the processes can help as well.

How Can I install php-imap on openshift

I have a PHP application running on Openshift and I need receive e-mails from gmail using imap protocol. In my local machine I am able to get emails from gmail using the same code, but when I am running from Openshift I can not get emails. I suppose that the problem is the php-imap which I had to install in my local machine. I am not sure if this module is already installed in Openshift. Should I install php-imap or this module is enable for default on server?
I don't know why but:
[some-domain.rhcloud.com 56956f307628e19496000093]\> php -v
PHP 5.3.3 (cli) (built: Jul 3 2015 03:10:33)
...
[some-domain.rhcloud.com 56956f307628e19496000093]\> php -m
[PHP Modules]
...
hash
iconv
imagick
imap
intl
json
libxml
...
[other-domain.rhcloud.com 5695463d89f5cf0a7e0001b5]\> php -v
PHP 5.4.40 (cli) (built: Jun 10 2015 06:44:21)
...
[other-domain.rhcloud.com 5695463d89f5cf0a7e0001b5]\> php -m
[PHP Modules]
...
hash
iconv
imagick
intl
json
ldap
libxml
...
So, if you need imap module you should use php-5.3
The easiest way to integrate email into your app is with Sendgrid from our Oenshift Marketplace here: https://marketplace.openshift.com/apps/9628?1665146903&restoreSearch=true#!overview. For reference, here are the extensions available in the php cartridge as of today:
$ php -m
[PHP Modules]
apc
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imagick
intl
json
ldap
libxml
mbstring
mcrypt
memcache
mhash
mongo
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib

Categories