Fatal error: Uncaught Error: Call to undefined function bcadd() - php

After installed "eduTrac SIS" and accessing "dashboard" got this error
Ubuntu 16.4, PHP 7.0(php7.0-fpm), Apache2, Nginx,
URL gives error 500 and nginx/error.log displays,
FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught
Error: Call to undefined function PHPBenchmark\bcadd() in
/var/www/html/eduTrac-SIS/app/src/vendor/phpbenchmark/phpbenchmark/lib/PHPBenchmark/Utils.php:18

PHP does not recognize "bcadd()" gives the error.
"bcadd()" function is included in "bcmath" PHP extention.
Just installing the relevant bcmath extension would solved the issue.
sudo apt-get install php7.0-bcmath
Please note, you should find the correct version of bcmath extension according to your PHP version.
And restart apache
sudo service apache2 restart

For PHP 7.4- bcmath, install with apt or yum as below:
sudo apt install php7.4-bcmath
or
sudo yum install php7.4-bcmath

Related

DrupalGap "Install SDK" Error: Fatal error: Class 'ZipArchive' not found in /../../.. /sites/all/modules/drupalgap/drupalgap.module on line 461

I am new to DrupalGap and while configuring DrupalGap I encountered the following error:
Fatal error: Class 'ZipArchive' not found in /../../.. /sites/all/modules/drupalgap/drupalgap.module on line 461
Reproduce Error
Navigate to Configuration/Web Services/DrupalGap
In the "Directory" section, clicked "Install SDK" button.
I have looked around and haven't found a clear solution to this issue. A user on another SO thread recommended installing the "Zip extension". I've tried that but am still getting the error.
Reference Thread
Fatal error: Class 'ZipArchive' not found in
http://www.php.net/manual/en/book.zip.php
Additional Notes
This "Install SDK" step worked fine on my local environment. I followed the same steps on my server
I'm running a D7 install
I'm using DrupalGap 7.x-1.15
Any help or advice would be greatly appreciated!
Thanks.
You need to install and enable PHP Zip extension to use ZipArchive class
For Ubuntu
PHP7 : sudo apt-get install php7.0-zip
PHP5 : sudo apt-get install php5-zip
Once the archive is installed restart your apache server and DONE !
For Ubuntu
sudo /etc/init.d/apache2 restart

php-mcrypt extension is not getting loaded

php-mcrypt extension is not getting loaded. It doesn't seems to be working.
I am using an Cent OS server.
I already tried many solution but didn't found any valuable.
Also php5enmod command is not working to enable an php-mcrypt extension.
I need this because while in the Magento checkout page it shows an error:
Fatal error: Call to undefined function mcrypt_module_open() in
/var/www/html/yms/lib/Varien/Crypt/Mcrypt.php on line 63
So need to get installed php-mcrypt extension.
Install mcrypt by using this command "yum install php55-php-mcrypt" for Cent OS server.

Fatal error: Call to undefined function mcrypt_get_block_size()

I am uploading my website on to a server, and it uploaded successfully. After that, when I run, it gives me this error:
Fatal error: Call to undefined function mcrypt_get_block_size().
I also check my PHP version on my server is 5.3.14. I couldn't figure out how I can deal with this. I used this function for query string encryption. I searched about this on Google and some people say you have to ask your host to install it. Is there another way to install this or alternate function that work just like this mcrypt_get_block_size()?
You have to install and enable mcrypt.
On a Debian based Linux distribution (like Ubuntu), run this from command line:
sudo apt-get install php5-mcrypt
As Alex said, you need to install the library, but don't forget to enable it.
sudo apt-get install mcrypt php5-mcrypt
sudo php5enmod mcrypt
sudo /etc/init.d/apache2 restart

Installing Solr in a XAMPP server in a LINUX server

I try to install Solr PHP extension to my webserver. I already have an XAMPP server and I'm using PECL to install solr
$ cd /opt/lampp/bin
$ sudo ./pecl install solr-1.0.1
But I got the following error:
checking libxml2 install dir... /usr/lib
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
ERROR: `/tmp/pear/temp/solr/configure --enable-solr=yes --enable-solr-debug=no --with-curl=
/usr --with-libxml-dir=/usr/lib' failed
During the installation it prompts me to input a path:
libxml2 install prefix [/usr] :
I have tried with enter and the /usr/lib
What shall I input there to not get an error? Or how shall I install to not get an error?
Now I have libxml2 installed through yum install libxml2-devel. But I got some wierd errors now. Here are just a few of them, it ends with:
no such parameter
/tmp/pear/temp/solr/solr_types.h:388: error: declaration for parameter 'client_count' but no such parameter
/tmp/pear/temp/solr/solr_types.h:386: error: declaration for parameter 'document_count' but no such parameter
/tmp/pear/temp/solr/solr_types.h:384: error: declaration for parameter 'request_count' but no such parameter
/tmp/pear/temp/solr/php_solr.c:1185: error: expected '{' at end of input
make: *** [php_solr.lo] Error 1 ERROR: `make' failed
If you're using RHEL/Fedora/CentOS/Scientific linux then you need to install libxml2-devel
yum install libxml2-devel
I could easily install PECL Solr via my systems package manager, probably this works for you as well. I found it very easy so probably worth to share (Fedora 14):
$ sudo yum install php-pecl-solr
A little later I got php-pecl-solr-0.9.11-1.fc14.x86_64 installed, the package's fedora homepage is here.
I could locate the libxml2 version with this command:
$ locate libxml2.so
probably this is helpful as well.
Some useful links:
http://projects.mediashelf.us/projects/8/wiki/Setting_up_Fedora_and_Solr_for_use_with_ActiveFedora#Install-Solr
http://oxfordrepo.blogspot.com/2008/01/populating-search-engine-apache-solr.html

Fatal error: Call to undefined function ldap_connect() in ubuntu

I'm trying to connect to my LDAP server via PHP, but I get the following error:
Fatal error: Call to undefined function ldap_connect()
Any help would be very appreciated.
Thanks in advance,
roshan
Make sure the LDAP extension is installed and enabled. This answer assumes you have PHP5, however, things should work similarly for PHP7 as well.
Install LDAP Extension
There should be a package named like php5-ldap:
aptitude show php5-ldap
Paquet : php5-ldap
...
Description : LDAP module for php5
This package provides a module for LDAP functions in PHP scripts.
Thus, the package can usually be installed like:
sudo apt-get install php5-ldap
If you do not use apt-get, use the equivalent command for the package manager you use.
Enable LDAP Extension
To enable the package after installation, you can use this command:
sudo php5enmod ldap
If you get any error message from the above command, it means something went wrong.
Note: After enabling the package, you usually have to restart / reload services so that the newly enabled module is recognized. For apache, you can do this by:
sudo service apache2 restart
If you do not use apache, please use the equivalent command for your server.
sudo apt-get install php5-ldap
And don't afraid to google.

Categories