ERROR sudo pecl install mongodb on Linux apache [duplicate] - php

This question already has answers here:
XML Extension not found
(2 answers)
PHP XML Extension: Not installed
(5 answers)
Pear error "XML Extension not found" on Ubuntu 14.04 after installing php-xml & php-xml7.0
(4 answers)
Closed last month.
I'm trying to install mongodb for php 7.4:
sudo pecl install mongodb
But i'm getting this error in the linux console.
Warning: Invalid argument supplied for foreach() in Command.php on line 249
PHP Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249
.....
XML Extension not found

The problem was that the xml extension was not enabled.
This worked for me:
sudo apt-get install php7.4-xml
and restart apache:
sudo service apache2 restart

Related

PHP startup issue on Ubuntu 18.04 [duplicate]

This question already has answers here:
PHP Startup Unable to load dynamic library /usr/lib/php/20151012/php_mysqli.dll
(10 answers)
Closed 3 years ago.
I'm running Ubuntu 18.04 with Apache and PHP 7.2. Everything works fine. My queries are working fine, but now and then I get error report with following description
PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib/php/20170718/mysqli (/usr/lib/php/20170718/mysqli: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/mysqli.so (/usr/lib/php/20170718/mysqli.so: undefined symbol: mysqlnd_global_stats))
I tried to search for it in php.ini but I can't find the problem. I tried to google it, but I can't find the same problem.
Does anyone have any idea what is causing it and how can I stop it?
Result from grep
You don't have php-mysql installed. To install that, open terminal and run this command:
sudo apt install php-mysql
after that you need to restart apache:
sudo service apache2 restart
You can check whether mysqli installed or not with this command line:
php -i | grep mysqli
I had the same problem, I solved changing php.ini
from:
extension=mysqli
to:
;extension=mysqli
because all mysqli settings already are here:
/etc/php/7.2/cli/conf.d/20-mysqli.ini

PhpSpreadSheet Class ZipArchive not found Error [duplicate]

This question already has answers here:
Fatal error: Class 'ZipArchive' not found in
(25 answers)
Closed 3 months ago.
I've just downloaded PhpSpreadsheet package via composer and I tried to generate an Excel spreadsheet. But all I get is an error "Class ZipArchive not found ". I work on Windows. In my localhost it is correctly generating excel. My localhost php version is 7.0.2 .But server Php Version is 5.6. I am not able to generate excel in server. I am getting "*Class ZipArchive not found" error.
I think you just need the PHP "zip" extension on your server...
If I understand well, your dev machine is on Windows. But your "production" machine is on... Linux?
If it's Debian :
apt-get install php-zip
If it's RedHat or whatever
yum install...
I update the Ubuntu 16.04 with php5.6 to Ubuntu 18.04 with php7.2.
Solved the same erorr with installing the php-zip as in the first post: sudo apt-get install php-zip, then restart the apache server: sudo service apache2 restart.
You have to reference ZipArchive in your PHP code:
use ZipArchive;

Fatal error: Call to undefined function mb_strtolower() even if mbstring is enabled [duplicate]

This question already has answers here:
Fatal error: Call to undefined function mb_detect_encoding()
(13 answers)
Closed 2 years ago.
I have just done an Os reload of my server and i've restored every thing and all data is correct but I am getting this:
Fatal error: Call to undefined function mb_strtolower()
I have done some searching around and I have found that its the mbstring exstention for php not being installed, that doesn't seem to be my case as i've checked and its installed and enabled for all phpversion.
Anyone got any ideas?
If you really have to use mb_-functions, you have to check if the multibyte string extension is installed on your system.
Check if the extension is installed?
<?php phpinfo(); ?>
Extension is not displayed?
Install the extension:
But therefore you have to reveal on which OS your PHP is running. So for example, in Ubuntu this can be achieved by running one of the following commands:
sudo apt-get install php-mbstring
sudo apt-get install php7.0-mbstring
sudo apt-get install php7.1-mbstring
Of course, this depends on the installed version of PHP.
DonĀ“t forget to restart PHP after the extension was installed.

Error loading pdo_mysql in php built-in server

I want to run php's built-in server (running by $ php -S localhost:8888) with PDO extension.
But when I type this command into terminal it gives me:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/pdo_mysql.so' - /usr/lib/php5/20121212/pdo_mysql.so: undefined symbol: pdo_parse_params in Unknown on line 0
(And when I try to use it it says that PDO class not found)
The same is when I run just $ php. But when I start apache2 server everything looks good (the PDO extension is working).
And the file /usr/lib/php5/20121212/pdo_mysql.so exists.
Thanks for your answers!
(running php 5 on ubuntu)
I've finally solved by reinstalling php:
Uninstall php with purge parameter:
sudo apt-get --purge remove php5-common
And install again:
sudo apt-get install php5 php5-mysql php5-curl etc...
Source: Error In PHP5 ..Unable to load dynamic library

Can't run PHP SOAP (looking for help or alternative)

I'm running CentOS 5.9 on this MediaTemple server with PHP 5.3.5, and I need to install SOAP for an API I'm building.
The phpinfo() output lists --enable-soap=shared already, so right off the bat I'm confused.
yum install php-soap doesn't work; it complains about "php-common = 5.1.6-43.el5_10" missing, yet yum install php-common says that php-common-5.1.6-43.el5_10.x86_64 is already installed.
I ended up just installing it manually like so:
wget ftp://fr2.rpmfind.net/linux/centos/5.10/updates/x86_64/RPMS/php-soap-5.1.6-43.el5_10.x86_64.rpm
rpm -Uvh --nodeps php-soap-5.1.6-43.el5_10.x86_64.rpm
And while it installed, I now get this error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/soap.so' - /usr/lib64/php/modules/soap.so: undefined symbol: zend_unmangle_property_name_ex in Unknown on line 0
I imagine there are some dependency issues but I can't figure out how to solve them.
At this rate I'm resorting to just using a non-plugin form of SOAP solution.

Categories