PHP 7: MongoDB Driver issue - php

I just got errors when I try to install MongoDB PHP Library:
$ composer require "mongodb/mongodb=^1.0.0"
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/mongodb.so' - /usr/lib/php/20151012/mongodb.so: undefined symbol: php_json_serializable_ce in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/mongodb.so' - /usr/lib/php/20151012/mongodb.so: undefined symbol: php_json_serializable_ce in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/mongodb.so' - /usr/lib/php/20151012/mongodb.so: undefined symbol: php_json_serializable_ce in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/mongodb.so' - /usr/lib/php/20151012/mongodb.so: undefined symbol: php_json_serializable_ce in Unknown on line 0
When I execute phpinfo() I can see the following:
mongodb
mongodb support enabled
mongodb version 1.2.1
mongodb stability stable
libmongoc version 1.5.0
libbson version 1.5.0
When I execute locate mongodb.so here's where my mongodb.so file is:
/usr/lib/php/20151012/mongodb.so
As I can notice, this is the path where 20-mongodb.ini file is:
/etc/php/7.0/apache2/conf.d
Also, sudo pecl mongodb install returns the following:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/mongodb.so' - /usr/lib/php/20151012/mongodb.so: undefined symbol: php_json_serializable_ce in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/mongodb.so' - /usr/lib/php/20151012/mongodb.so: undefined symbol: php_json_serializable_ce in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/mongodb.so' - /usr/lib/php/20151012/mongodb.so: undefined symbol: php_json_serializable_ce in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/mongodb.so' - /usr/lib/php/20151012/mongodb.so: undefined symbol: php_json_serializable_ce in Unknown on line 0
sudo pecl info mongodb returns:
About pecl.php.net/mongodb-1.2.1
================================
Release Type PECL-style PHP extension (source code)
Name mongodb
Channel pecl.php.net
Summary MongoDB driver for PHP
Description The purpose of this driver is to provide
exceptionally thin glue between MongoDB
and PHP, implementing only fundemental and
performance-critical components
necessary to build a fully-functional MongoDB
driver.
Maintainers Hannes Magnusson <bjori#php.net> (lead)
Jeremy Mikola <jmikola#php.net> (lead)
Derick Rethans <derick#php.net> (lead)
Release Date 2016-12-07 18:25:03
Release Version 1.2.1 (stable)
API Version 1.2.1 (stable)
License Apache License
(http://www.apache.org/licenses/LICENSE-2.0)
Release Notes ** Bug
* [PHPC-848] - Fix BSON encoding of
immutable arrays and documents with circular
references
Required Dependencies PHP version 5.4.0-7.99.99
PEAR installer version 1.4.8 or newer
package.xml version 2.0
Last Modified 2016-12-09 00:28
Previous Installed 1.2.0
Version
I searched on Google for a few hours, but still nothing. Thank you.

Yes, there are good answers.
Here's what I did to install mongo in php7.1. I am using ubuntu16.04 64bit:
sudo aptitude install -y php7.1-dev pkg-config
sudo -H pecl channel-update pecl.php.net
sudo aptitude install -y libcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev
sudo pecl install mongodb
echo 'extension=mongodb.so' | sudo tee /etc/php/7.1/fpm/conf.d/30-mongodb.ini
echo 'extension=mongodb.so' | sudo tee /etc/php/7.1/cli/conf.d/30-mongodb.ini
sudo systemctl restart php7.1-fpm.service
It it all for nginx. If you are using apache, please add:
echo 'extension=mongodb.so' | sudo tee /etc/php/7.1/apache2/conf.d/30-mongodb.ini
And one more. If you continue to have an error when working with mongo. Something like that:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/mongodb.so' - libssl.so.1.0.2: cannot open shared object file: No such file or directory in Unknown on line 0
Do not despair, run the following commands:
sudo pecl uninstall mongodb
sudo pecl install mongodb

First type this command /usr/bin/php-config to see where the extension directory is.
You will see something like this --extension-dir [/usr/lib/php/20131226]
Than ls in that folder see if the mongo.so is there , if not put it there.
Type whereis php to locate the php you are using in CLI
Edit the php.ini for the CLI and add the extension=mongo.so

Use the 1.1.9 mongodb version:
sudo pecl uninstall mongodb
sudo pecl install mongodb-1.1.9
composer update

I did as #Andrinux and #J.C. Gras suggestions and I got an error phpize not found.
So I did research and found this How to install and run phpize. This is because php-dev was not installed on my system, so I did install it.
In the sequence, I did:
// Ubuntu 20.04.3
$ sudo apt-get update
$ sudo apt install php-dev
$ sudo pecl install mongodb (at the time, it installed mongodb-1.10.0)
If you see this message, the extension has successfully installed
Build complete.
Don't forget to run 'make test'.
running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-rootDvmP4U/install-mongodb-1.10.0" install
Installing shared extensions: /tmp/pear/temp/pear-build-rootDvmP4U/install-mongodb-1.10.0/usr/lib/php/20200930/
running: find "/tmp/pear/temp/pear-build-rootDvmP4U/install-mongodb-1.10.0" | xargs ls -dils
52067 4 drwxr-xr-x 3 root root 4096 Sep 28 16:18 /tmp/pear/temp/pear-build-rootDvmP4U/install-mongodb-1.10.0
52629 4 drwxr-xr-x 3 root root 4096 Sep 28 16:18 /tmp/pear/temp/pear-build-rootDvmP4U/install-mongodb-1.10.0/usr
52630 4 drwxr-xr-x 3 root root 4096 Sep 28 16:18 /tmp/pear/temp/pear-build-rootDvmP4U/install-mongodb-1.10.0/usr/lib
52631 4 drwxr-xr-x 3 root root 4096 Sep 28 16:18 /tmp/pear/temp/pear-build-rootDvmP4U/install-mongodb-1.10.0/usr/lib/php
52632 4 drwxr-xr-x 2 root root 4096 Sep 28 16:18 /tmp/pear/temp/pear-build-rootDvmP4U/install-mongodb-1.10.0/usr/lib/php/20200930
52627 8708 -rwxr-xr-x 1 root root 8916120 Sep 28 16:18 /tmp/pear/temp/pear-build-rootDvmP4U/install-mongodb-1.10.0/usr/lib/php/20200930/mongodb.so
Build process completed successfully
Installing '/usr/lib/php/20200930/mongodb.so'
install ok: channel://pecl.php.net/mongodb-1.10.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=mongodb.so" to php.ini
Don't forget to restart PHP-FPM and APACHE server

Related

PHP Warning - PHP Startup: Unable to load dynamic library 'imagick.so'

Has anyone come across this warning before? Any files I should check other than php.ini or 00-ioncube.ini? Those look to be in good order.
$ php -v
PHP Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib64/php/modules/imagick.so (libMagickWand.so.5: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/imagick.so.so (/usr/lib64/php/modules/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.3.31 (cli) (built: Sep 21 2021 10:24:03) ( NTS )
Operating System:
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-1160.42.2.el7.x86_64
Architecture: x86-64
I upgraded PHP from version 7.1 to 7.3 on using these steps:
php -v
sudo yum install epel-release
yum --enablerepo=remi-php73 install php
php -v
systemctl restart httpd
I only see one php.ini file loaded in /etc/
Check how was the imagick extension was installed:
rpm -qf /usr/lib64/php/modules/imagick.so
It looks like it is not provided by a RPM, nor built for the proper PHP version you are running (libMagickWand.so.5 is also an old version).
For a proper configuration / installation, see the Wizard instructions
At least I recommend you enable the remi-php73 repository permanently, to ensure all extensions are taken from it.
yum-config-manager --enable remi-php73
Then you can install the imagick extension, or any other extension you need
yum install php-imagick
Notice, in this repository you have the choice between 2 variants of this extension, above command will pick one among:
php-pecl-imagick-im6 build with ImageMagick version 6 (libMagickCore-6.Q16.so.7, libMagickWand-6.Q16.so.7)
php-pecl-imagick-im7 build with ImageMagick version 7 (libMagickCore-7.Q16HDRI.so.10, libMagickWand-7.Q16HDRI.so.10)
APIs are slightly different.

Problems with msqli and mssql and broken php7.2 on linux

I have a local application with laravel 5.5 using a mysql databse on my ubuntu18.04.1. It is hosted on a server with php7.2, and I had the same version of php in my system. All was working fine. Yesterday, I tried to connect my app with SQL Server to get data from a database, and my nightmare started.
I added the data base connection info to the database.php file in my laravel app following this format
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
All seemed to be working fine, but when I tried to retrieve data, I had a connection exception, laravel was telling me that the sqlsrv driver wasn't found. I thought that, perhaps, the sqlsrv extension wasn't enabled, so I went to php.ini to activate it, but I didn't found it, so I started to investigate and I discovered that I had to install it from the microsoft webpage. I tried in all ways to add the proper .so, I installed and deinstalled php7.2 and I don't know how php7.4 folders and modules are on my system too. I followed this site (in spanish) to install a docker and try to prevent this situation in the future. I followed it till the $ sudo docker-compose up -d nginx mysql phpmyadmin part, then I tried to run my app and it works, it connects properly, but I cannot access to phpmyadmin via http://localhost:3030/, I have phpMyAdmin Error because it doesn't find the mysqli extension.
Then I tired to run php -S as I used to run when I trying to connect to phpMyAdmin and I get this
$ php -S localhost:3030
[Thu Dec 10 13:17:50 2020] PHP Warning: 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)) in Unknown on line 0
[Thu Dec 10 13:17:50 2020] PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib/php/20170718/pdo_mysql (/usr/lib/php/20170718/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_mysql.so (/usr/lib/php/20170718/pdo_mysql.so: undefined symbol: mysqlnd_allocator)) in Unknown on line 0
[Thu Dec 10 13:17:50 2020] PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20170718/pdo_sqlite (/usr/lib/php/20170718/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_sqlite.so (/usr/lib/php/20170718/pdo_sqlite.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[Thu Dec 10 13:17:50 2020] PHP Warning: PHP Startup: Unable to load dynamic library 'pgsql' (tried: /usr/lib/php/20170718/pgsql (/usr/lib/php/20170718/pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pgsql.so (/usr/lib/php/20170718/pgsql.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[Thu Dec 10 13:17:50 2020] Failed to listen on localhost:3030 (reason: Address already in use)
I ran php --ini to find where the configuration file is and edited the extension of mysqli to enable it, now when y run again php --ini I get this warns
$ php --ini
PHP Warning: 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)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib/php/20170718/pdo_mysql (/usr/lib/php/20170718/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_mysql.so (/usr/lib/php/20170718/pdo_mysql.so: undefined symbol: mysqlnd_allocator)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20170718/pdo_sqlite (/usr/lib/php/20170718/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_sqlite.so (/usr/lib/php/20170718/pdo_sqlite.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pgsql' (tried: /usr/lib/php/20170718/pgsql (/usr/lib/php/20170718/pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pgsql.so (/usr/lib/php/20170718/pgsql.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Configuration File (php.ini) Path: /etc/php/7.2/cli
Loaded Configuration File: /etc/php/7.2/cli/php.ini
Scan for additional .ini files in: /etc/php/7.2/cli/conf.d
Additional .ini files parsed: /etc/php/7.2/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.2/cli/conf.d/10-opcache.ini,
/etc/php/7.2/cli/conf.d/10-pdo.ini,
/etc/php/7.2/cli/conf.d/20-calendar.ini,
/etc/php/7.2/cli/conf.d/20-ctype.ini,
/etc/php/7.2/cli/conf.d/20-exif.ini,
/etc/php/7.2/cli/conf.d/20-fileinfo.ini,
/etc/php/7.2/cli/conf.d/20-ftp.ini,
/etc/php/7.2/cli/conf.d/20-gettext.ini,
/etc/php/7.2/cli/conf.d/20-iconv.ini,
/etc/php/7.2/cli/conf.d/20-json.ini,
/etc/php/7.2/cli/conf.d/20-mysqli.ini,
/etc/php/7.2/cli/conf.d/20-pdo_mysql.ini,
/etc/php/7.2/cli/conf.d/20-phar.ini,
/etc/php/7.2/cli/conf.d/20-posix.ini,
/etc/php/7.2/cli/conf.d/20-readline.ini,
/etc/php/7.2/cli/conf.d/20-shmop.ini,
/etc/php/7.2/cli/conf.d/20-sockets.ini,
/etc/php/7.2/cli/conf.d/20-sysvmsg.ini,
/etc/php/7.2/cli/conf.d/20-sysvsem.ini,
/etc/php/7.2/cli/conf.d/20-sysvshm.ini,
/etc/php/7.2/cli/conf.d/20-tokenizer.ini
and I still can't access to phpMyAdmin. When I run php --version I get this
$ php --version
PHP Warning: 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)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib/php/20170718/pdo_mysql (/usr/lib/php/20170718/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_mysql.so (/usr/lib/php/20170718/pdo_mysql.so: undefined symbol: mysqlnd_allocator)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20170718/pdo_sqlite (/usr/lib/php/20170718/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_sqlite.so (/usr/lib/php/20170718/pdo_sqlite.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pgsql' (tried: /usr/lib/php/20170718/pgsql (/usr/lib/php/20170718/pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pgsql.so (/usr/lib/php/20170718/pgsql.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.2.34-8+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Oct 31 2020 16:57:15) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.34-8+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
I need to fix this asap to continue working on my laravel application and, when it's done, I need a correct way to install the proper sqlsrv drivers to be able to connect my laravel application to the sql server database.
When I run php -m I get this
$ php -m
PHP Warning: 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)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib/php/20170718/pdo_mysql (/usr/lib/php/20170718/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_mysql.so (/usr/lib/php/20170718/pdo_mysql.so: undefined symbol: mysqlnd_allocator)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20170718/pdo_sqlite (/usr/lib/php/20170718/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_sqlite.so (/usr/lib/php/20170718/pdo_sqlite.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pgsql' (tried: /usr/lib/php/20170718/pgsql (/usr/lib/php/20170718/pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pgsql.so (/usr/lib/php/20170718/pgsql.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[PHP Modules]
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib
[Zend Modules]
Zend OPcache
and this is what I have now installed with php, nginx, and sql
$ dpkg --get-selections | grep php
libapache2-mod-php7.2 install
php-common install
php-mysql install
php7.2 install
php7.2-cli install
php7.2-common install
php7.2-fpm install
php7.2-json install
php7.2-mysql install
php7.2-opcache install
php7.2-readline install
php7.4-common install
php7.4-mysql
$ dpkg --get-selections | grep nginx
libnginx-mod-http-geoip install
libnginx-mod-http-image-filter install
libnginx-mod-http-xslt-filter install
libnginx-mod-mail install
libnginx-mod-stream install
nginx install
nginx-common install
nginx-core install
$ dpkg --get-selections | grep sql
akonadi-backend-mysql install
libaprutil1-dbd-sqlite3:amd64 install
libmono-sqlite4.0-cil install
libmysqlclient20:amd64 install
libmysqlcppconn7v5:amd64 install
libqt4-sql:amd64 install
libqt4-sql-mysql:amd64 install
libqt5sql5:amd64 install
libqt5sql5-mysql:amd64 install
libqt5sql5-sqlite:amd64 install
libsqlite3-0:amd64 install
libvsqlitepp3v5:amd64 install
msodbcsql17 install
mssql-server install
mssql-tools install
mysql-client install
mysql-client-5.7 install
mysql-client-core-5.7 install
mysql-common install
mysql-server install
mysql-server-5.7 install
mysql-server-core-5.7 install
mysql-utilities install
mysql-workbench install
mysql-workbench-data install
php-mysql install
php7.2-mysql install
php7.4-mysql install
postgresql install
postgresql-10 install
postgresql-client-10 install
postgresql-client-common install
postgresql-common install
postgresql-contrib install
python-mysql.connector install
python-pysqlite2 install
Does anyone know what could I do?
If you need more info tell me in the comments and I'll update the question.
Thanks!
Update 1: Nothing is working yet
I tried to follow this thread to uninstall all php and php7 file and tried to reinstall php7.2, but I can't add the repository when I execute add-apt-repository ppa:ondrej/php becaus the terminal throws me this
Obj:1 https://download.docker.com/linux/ubuntu bionic InRelease
Ign:2 http://ppa.launchpad.net/langdalepl/gvfs-mtp/ubuntu bionic InRelease
Obj:3 https://linux.teamviewer.com/deb stable InRelease
Obj:4 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
Obj:5 http://dl.google.com/linux/chrome/deb stable InRelease
Obj:6 http://ppa.launchpad.net/wireshark-dev/stable/ubuntu bionic InRelease
Obj:7 http://es.archive.ubuntu.com/ubuntu bionic InRelease
Des:8 http://security.ubuntu.com/ubuntu bionic-security InRelease [88,7 kB]
Des:9 http://archive.neon.kde.org/user bionic InRelease [131 kB]
Obj:10 https://packages.microsoft.com/ubuntu/18.04/mssql-server-2019 bionic InRelease
Err:11 http://ppa.launchpad.net/langdalepl/gvfs-mtp/ubuntu bionic Release
404 Not Found [IP: 91.189.95.83 80]
Ign:12 https://storage.googleapis.com/download.dartlang.org/linux/debian stable InRelease
Obj:13 https://packages.microsoft.com/ubuntu/18.04/prod bionic InRelease
Des:14 http://es.archive.ubuntu.com/ubuntu bionic-updates InRelease [88,7 kB]
Obj:15 https://packages.microsoft.com/ubuntu/16.04/prod xenial InRelease
Obj:16 https://storage.googleapis.com/download.dartlang.org/linux/debian stable Release
Des:17 http://es.archive.ubuntu.com/ubuntu bionic-backports InRelease [74,6 kB]
E: The repository 'http://ppa.launchpad.net/gnome-shell-extensions/ppa/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
I searched for my error and found this, but it doesn't worked for me.
I tried to install php7.2 following the thread and all went well, but when I've executed sudo service apache2 restart I got this
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
so I executed systemctl status apache2.service and it threw this
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Fri 2020-12-11 10:34:22 CET; 1min 31s ago
Process: 4671 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
dic 11 10:34:22 Dev-PC apachectl[4671]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directiv
dic 11 10:34:22 Dev-PC apachectl[4671]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
dic 11 10:34:22 Dev-PC apachectl[4671]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
dic 11 10:34:22 Dev-PC apachectl[4671]: no listening sockets available, shutting down
dic 11 10:34:22 Dev-PC apachectl[4671]: AH00015: Unable to open logs
dic 11 10:34:22 Dev-PC apachectl[4671]: Action 'start' failed.
dic 11 10:34:22 Dev-PC apachectl[4671]: The Apache error log may have more information.
dic 11 10:34:22 Dev-PC systemd[1]: apache2.service: Control process exited, code=exited status=1
dic 11 10:34:22 Dev-PC systemd[1]: apache2.service: Failed with result 'exit-code'.
dic 11 10:34:22 Dev-PC systemd[1]: Failed to start The Apache HTTP Server.
What could I do now? I cannot start apache service and I don't know what is failing here...
Update 2: My app and apache2 are working now
I updated my download manager to look for available repositories and bingo, the ondrej repositories were locked, I just unlocked them and tried again to adding the repositories, it worked now. I've reinstalled apache2 with and php7.2 running sudo apt-get install apache2 and following the thread answer. But I had the same problem, so I realized that the error was showing two problems, the first problem was the missing server name and the second was that the port 80 was in use, thats why the apache2 keeps failing when trying to start. For solve the first problem, I ran sudo gedit /etc/apache2/apache2.conf and added Server Name 127.0.0.1 and after save, the first problem was solved, I solved the second problem running sudo lsof -i -n -P | grep ':80' and I discovering that nginx process was using it, so I used sudo kill [the nginx PID] to kill the nginx processes and retried to start apache2 and now it worked. I was able to access to my database in phpmyadmin but now I had another problem, when I execute php artisan serve in my laravel project, I got a PDOConnection.php error because there was a missing driver, and after execute php -m I realized that was the mysql driver so I ran sudo apt-get install php7.2-common php7.2-mysql php7.2-cli and finally I had my apache2 and my php7.2 fixed! Finally thank you all for helping me!
But now I have the same problem I had when all this started, I need to install in the correct way the sqlsrv .so drivers to be able to connect my laravel app with a SQL Server database. I was trying to download the .so files from the microsoft page but that drove me to this nightmare, so does anybody knows how could I continue to installing the sqlsrv drivers correctly?
Update 3: Finally, solved!
Looking for solutions, I checked again the microsoft webpage to find out which sqlsrv drivers I needed to run sql queries with php7.2, and I tried again to run sudo pecl install sqlsrv and sudo pecl install pdo_sqlsrv, but it didn't worked for me. Then I found another way to install the drivers without pecl, and i ran sudo apt-get install php7.2-dev and downloaded the packages with wget http://pecl.php.net/get/sqlsrv-5.3.0.tgz and wget http://pecl.php.net/get/pdo_sqlsrv-5.3.0.tgz (5.3.0 was my sqlsrv version for php7.2), after this I installed with pear install pdo_sqlsrv-5.3.0.tgz and pear install sqlsrv-5.3.0.tgz. This time it worked for me (first time it throwed to me an error telling me that there was an installed version of pdo_sqlsrv, but I ran sudo pear uninstall pecl/pdo_sqlsrv and ran again the install order, then it worked for me). Then, I tried again to run sudo pecl install sqlsrv and sudo pecl install pdo_sqlsrv and this time it worked! After this I ran sudo phpenmod -v 7.2 sqlsrv pdo_sqlsrv and finally I finished the php7.2 sqlsrv drivers installation in my ubuntu! I tried to run again the connection to my database on sql server and it worked.
Thanks for the help!
I updated my post with my progress solving my own question, with the help of bhucho in the comments of my post, I was able to fix my php7.2.
Looking for solutions for install the correct sqlsrv driver for my php version, I checked again the microsoft webpage to find out which sqlsrv drivers I needed to run sql queries with php7.2, and I tried again to run sudo pecl install sqlsrv and sudo pecl install pdo_sqlsrv, but it didn't worked for me. Then I found another way to install the drivers without pecl, and i ran sudo apt-get install php7.2-dev and downloaded the packages with wget http://pecl.php.net/get/sqlsrv-5.3.0.tgz and wget http://pecl.php.net/get/pdo_sqlsrv-5.3.0.tgz (5.3.0 was my sqlsrv version for php7.2), after this I installed with pear install pdo_sqlsrv-5.3.0.tgz and pear install sqlsrv-5.3.0.tgz. This time it worked for me (first time it throwed to me an error telling me that there was an installed version of pdo_sqlsrv, but I ran sudo pear uninstall pecl/pdo_sqlsrv and ran again the install order, then it worked for me). Then, I tried again to run sudo pecl install sqlsrv and sudo pecl install pdo_sqlsrv and this time it worked! After this I ran sudo phpenmod -v 7.2 sqlsrv pdo_sqlsrv and finally I finished the php7.2 sqlsrv drivers installation in my ubuntu! I tried to run again the connection to my database on sql server and it worked.
Thank you all for the help!

How to install ImageMagick, ImageMagick-devel and PECL imagick on RHEL 8

It appears ImageMagick and ImageMagick-devel are removed from RHEL 8.
I have added 3rd party repositories such as EPEL, REMI, & RPMFusion.
I am able to install the GraphicsMagick replacement for Imagemagick but it appears Gmagick is not compatible with ImageMagick at PHP library code level.
So the below method does not help... for the plugin I am using which depends on PHP Imagemagick, while using Gmagick to convert something in the CLI it will work.
$ dnf install GraphicsMagick GraphicsMagick-devel GraphicsMagick-perl ghostscript
$ cd /usr/local/src
$ wget https://pecl.php.net/get/gmagick
$ tar xfvz gmagick $ cd gmagick-*
$ phpize
$ ./configure
$ make
$ make installl
$ php --ini | grep 'Loaded Configuration File'
$ nano /etc/php.ini
// add extension to end of php.ini
extension=gmagick.so
When trying to install ImageMagick
$ sudo yum install ImageMagick-devel
No match for argument: ImageMagick-deval
Error: Unable to find a match: ImageMagick-deval
$ pecl install imagick
checking whether to enable the imagick extension... yes, shared
checking for pkg-config... /bin/pkg-config
checking ImageMagick MagickWand API configuration program... checking
Testing /usr/local/bin/MagickWand-config... Doesn't exist
checking Testing /usr/bin/MagickWand-config... Doesn't exist
checking Testing /usr/sbin/bin/MagickWand-config... Doesn't exist
checking Testing /opt/bin/MagickWand-config... Doesn't exist
checking Testing /opt/local/bin/MagickWand-config... Doesn't exist
configure: error: not found. Please provide a path to MagickWand-config
or Wand-config program.
ERROR: `/var/tmp/imagick/configure --with-php-config=/bin/php-config
--with-imagick' failed
Is there a way to manually get ImageMagick, ImageMagick-devel and PECL Imagick installed on RHEL 8 (NOT Gmagick)
EDIT
# dnf repolist
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:00:17 ago on Fri 28 Feb 2020 20:58:19 UTC.
repo id repo name status
*epel Extra Packages for Enterprise Linux 8 - x86_64 4,916
*epel-modular Extra Packages for Enterprise Linux Modular 8 - x86_64 0
remi-modular Remi's Modular repository for Enterprise Linux 8 - x86_64 16
remi-safe Safe Remi's RPM repository for Enterprise Linux 8 - x86_64 2,133
rhel-8-appstream-rhui-rpms Red Hat Enterprise Linux 8 for x86_64 - AppStream from RHUI (RPMs) 8,566
rhel-8-baseos-rhui-rpms Red Hat Enterprise Linux 8 for x86_64 - BaseOS from RHUI (RPMs) 3,690
rhui-client-config-server-8 Red Hat Update Infrastructure 3 Client Configuration Server 8 6
rpmfusion-free-updates RPM Fusion for EL 8 - Free - Updates
# yum install ImageMagick-devel
Error:
Problem: conflicting requests
- nothing provides jasper-devel needed by ImageMagick-devel-6.9.10.86-1.el8.x86_64
- nothing provides OpenEXR-devel needed by ImageMagick-devel-6.9.10.86-1.el8.x86_64
- nothing provides ghostscript-devel needed by ImageMagick-devel-6.9.10.86-1.el8.x86_64
- nothing provides lcms2-devel needed by ImageMagick-devel-6.9.10.86-1.el8.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
SOLVED - https://www.imagemagick.org/script/install-source.php#unix
$ cd ImageMagick-7.0.9-26
$ ./configure
$ make
$ make install
$ sudo ldconfig /usr/local/lib
$ pecl install imagick
$ nano /etc/php.ini
// Add the following
extension=imagick.so
Works after removing Gmagick
Clean try with
$ sudo dnf install ImageMagick
$ dnf install php73-php-pecl-imagick
# php --ini | grep 'Loaded Configuration File'
PHP Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib64/php/modules/imagick.so (/usr/lib64/php/modules/imagick.so: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/imagick.so.so (/usr/lib64/php/modules/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Loaded Configuration File: /etc/php.ini
# ls
bz2.so curl.so fileinfo.so gettext.so json.so mysqli.so pdo_mysql.so phar.so simplexml.so sysvmsg.so tokenizer.so xml.so
calendar.so dom.so ftp.so iconv.so mbstring.so mysqlnd.so pdo.so posix.so sockets.so sysvsem.so wddx.so xmlwriter.so
ctype.so exif.so gd.so intl.so mcrypt.so opcache.so pdo_sqlite.so shmop.so sqlite3.so sysvshm.so xmlreader.so xsl.so
nothing shown in php -m for imagick
# php -v
PHP Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib64/php/modules/imagick.so (/usr/lib64/php/modules/imagick.so: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/imagick.so.so (/usr/lib64/php/modules/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.3.5 (cli) (built: Apr 30 2019 08:37:17) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.5, Copyright (c) 1999-2018, by Zend Technologies
It looks like you seek to install PHP imagick module while having Remi repos around. So why not install directly the packaged module in lieu of compiling it?
Instead of pecl install imagick you can do something like dnf install php74-php-pecl-imagick. The actual command depends on whether you want multiple PHP versions or replace the default one, use config wizard for a hint.
Then you will not need any -devel packages installed.
If for some reason you don't want to rely on a packaged install the PHP module and really want to compile, you need to enable CodeReady Builder repo:
sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-*-rpms"
CENTOS 8
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
dnf install GraphicsMagick

PHP Startup: Unable to load dynamic library 'phalcon.so'

I am trying to run phalcon in php but it seems from the errors that it cannot load it.
PHP Warning: PHP Startup: Unable to load dynamic library 'phalcon.so' (tried: /usr/lib64/php/modules/phalcon.so (/usr/lib64/php/modules/phalcon.so: undefined symbol: __builtin_saddl_overflow), /usr/lib64/php/modules/phalcon.so.so (/usr/lib64/php/modules/phalcon.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
I've tried all the solutions that are on the web but I cant solve it.
I already add the extension=phalcon.so in php.ini and also made a file zzzzz.ini which contains the same extension but it does not work.
Those are the solutions that I found on the web.
Can someone else help me to solve my problem ?
Thanks in advance
Edit 1
GCC Version: gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
I had the same problem, i resolved by upgrading GCC to >= 5.0 then recompiled Phalcon. For centOS 7
sudo yum install -y yum-utils centos-release-scl;
sudo yum -y --enablerepo=centos-sclo-rh-testing install devtoolset-7-gcc;
echo "source /opt/rh/devtoolset-7/enable" | sudo tee -a /etc/profile;
source /opt/rh/devtoolset-7/enable;
gcc --version;

Error In PHP5 ..Unable to load dynamic library gd.so

litingjun#litingjun-All-Series:/etc/php5/cli/conf.d$ php -a
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/gd.so' - /usr/lib/php5/20121212/gd.so: undefined symbol: gdImageCreateFromGd2Part in Unknown on line 0
litingjun#litingjun-All-Series:/etc/php5/cli/conf.d$ ls /usr/lib/php5/20121212/gd.so
/usr/lib/php5/20121212/gd.so
I've tried reinstalling gd using sudo apt-get install php5-gd but still not work.
My PHP version: 5.5.9-1ubuntu4.11
I need gd.
Thanks
I've reinstalled my OS and problem's gone.

Categories