Solved

PHP Fatal error: Uncaught Error: Class "PDOStatement" not found

  • 30 May 2023
  • 2 replies
  • 230 views

Badge +1

Hi everyone,

I have to upgrade my centreon platform (21.04 version) to the lastest version (22.04 or more).

I followed this centreon documentation https://docs.centreon.com/fr/docs/upgrade/upgrade-from-21-04/, i tried many times but i always have this PHP error :

 

PHP Fatal error:  Uncaught Error: Class "PDOStatement" not found in /usr/share/centreon/www/class/centreonDBStatement.class.php:45
Stack trace:
#0 /usr/share/centreon/www/class/centreonDB.class.php(43): require_once()
#1 /usr/share/centreon/www/api/class/webService.class.php(37): require_once('/usr/share/cent...')
#2 /usr/share/centreon/vendor/composer/autoload_real.php(45): require('/usr/share/cent...')
#3 /usr/share/centreon/vendor/composer/autoload_real.php(49): {closure}('d6c030a8a6c825a...', '/usr/share/cent...')
#4 /usr/share/centreon/vendor/autoload.php(25): ComposerAutoloaderInitfd589ed8b5324cff20dd5cd71625c158::getLoader()
#5 /usr/share/centreon/config/bootstrap.php(24): require('/usr/share/cent...')
#6 /usr/share/centreon/bin/centreon(42): require_once('/usr/share/cent...')
#7 {main}
  thrown in /usr/share/centreon/www/class/centreonDBStatement.class.php on line 45

 

I have many erros about dynamic library like :

[root@EQX-ESX-SUPCR php.d]# php -v
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql.so' 
PHP Warning:  PHP Startup: Unable to load dynamic library 'ctype.so' 
PHP Warning:  PHP Startup: Unable to load dynamic library 'iconv.so' 
PHP Warning:  PHP Startup: Unable to load dynamic library 'xml.so' 
PHP Warning:  PHP Startup: Unable to load dynamic library 'soap.so' 
PHP Warning:  PHP Startup: Unable to load dynamic library 'memcache.so' 

and more (...)

PHP 8.1.19 (cli) (built: May 10 2023 13:43:03) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.19, Copyright (c) Zend Technologies
    with SourceGuardian v14.0.2, Copyright (c) 2000-2023, by SourceGuardian Ltd.

 

Obviously, with those errors it’s not possible to access to the web interface and start the final upgrade.

Do you have, please, any ideas ?

 

Thx for you help.

Antoine.

icon

Best answer by Dubz 30 May 2023, 15:31

View original

2 replies

Badge +1

Finally resolved the issue 😓

PHP tried to load dynamic library to this path opt/rh/rh-php72/root/usr/lib64/php/modulesin /etc/php.ini configuration file :

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
extension_dir = "opt/rh/rh-php72/root/usr/lib64/php/modules/"
; On windows:
; extension_dir = "ext"

 

So I remplaced this path with the correct one that is /usr/lib64/php/modules/ in /etc/php.ini configuration file :

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
extension_dir = "/usr/lib64/php/modules/"
; On windows:
; extension_dir = "ext"

 

Reloaded php-fpm and verified with php -v :

[root@EQX-ESX-SUPCR nomoeng]# php -v
PHP 8.1.19 (cli) (built: May 10 2023 13:43:03) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.19, Copyright (c) Zend Technologies
    with SourceGuardian v13.0.3, Copyright (c) 2000-2022, by SourceGuardian Ltd.

 

Issue solved.

Userlevel 5
Badge +11

Thanks @Dubz for sharing how you solved the problem, I'm sure this will help someone! 

Reply