You are not logged in.

#1 2021-02-05 20:38:36

Watnuss
Member
Registered: 2013-03-04
Posts: 53

[SOLVED] PHP7 PDO mysql driver not loaded

Hi there,

I am trying to fix my php7 setup for some time now, without success. I now need some help because I just have no idea what to try next.

None of my php webapps do work. Any hints are welcome. I start with the error given by tt-rss:

Exception while creating PDO object:could not find driver

So I check if my php7 setup is configured correctly:

php7 -m |grep pdo
pdo_mysql

php7 -i |grep PDO
PDO
PDO support => enabled
PDO drivers => mysql
PDO Driver for MySQL => enabled

cat /etc/httpd/conf/httpd.conf |grep -i php
LoadModule php7_module modules/libphp7.so
Include conf/extra/php7_module.conf

I created an info.php and there I can see that the PDO driver is not loaded:
mnc5jUI.png
I assume on a working setup, "mysql" would be listed in this category. But I don't see why it shouldn't be loaded.

I am happy to produce any logs you may need to help me. Thanks already for reading until here and best regards,

watnuss

Last edited by Watnuss (2021-02-08 20:29:03)

Offline

#2 2021-02-08 13:11:50

Watnuss
Member
Registered: 2013-03-04
Posts: 53

Re: [SOLVED] PHP7 PDO mysql driver not loaded

*bump*
I am going to build a mirror setup of the system in question trying to figure out what is wrong, next. In the meantime, I would be immensely thankful for any input.

Offline

#3 2021-02-08 17:44:56

hoerbert
Member
Registered: 2013-04-03
Posts: 87

Re: [SOLVED] PHP7 PDO mysql driver not loaded

Hey watnuss,

i just set up a test-vm with a basic apache-php7-mysql-installation and after configuring it there was nothing special about getting PDO to work…

Could you share your complete phpinfo()-test-page as well as the output of

grep pdo /etc/php7/php.ini 

?

Offline

#4 2021-02-08 19:07:44

Watnuss
Member
Registered: 2013-03-04
Posts: 53

Re: [SOLVED] PHP7 PDO mysql driver not loaded

Hi hoerbert,

the phpinfo() output can be found at nopaste.ml (This site encodes the paste in the url. Pastebin was not working for me.)
And

grep pdo /etc/php7/php.ini
;extension=pdo_dblib
extension=pdo_mysql
;extension=pdo_odbc
;extension=pdo_pgsql
;extension=pdo_sqlite
; http://php.net/pdo-odbc.connection-pooling
;pdo_odbc.connection_pooling=strict
;pdo_odbc.db2_instance_name
pdo_mysql.default_socket=

Thanks a lot!

watnuss

Last edited by Watnuss (2021-02-08 19:09:06)

Offline

#5 2021-02-08 19:58:13

hoerbert
Member
Registered: 2013-04-03
Posts: 87

Re: [SOLVED] PHP7 PDO mysql driver not loaded

There is a non-standard  loaded configuration file. =>

Loaded Configuration File: /etc/webapps/tt-rss/php.ini

I dont't know why it is loaded, but my guess is, that you have to enable the pdo-extension in this file, because the standard file does not seem to be loaded.

Offline

#6 2021-02-08 20:28:37

Watnuss
Member
Registered: 2013-03-04
Posts: 53

Re: [SOLVED] PHP7 PDO mysql driver not loaded

Thanks for the pointer. This config is loaded for the tt-rss webapp I am running.

 cat /etc/httpd/conf/httpd.conf|grep tt-rss
# tt-rss settings
Include conf/extra/tt-rss.conf

And that config looks like:

cat /etc/httpd/conf/extra/tt-rss.conf
<VirtualHost *:443>
    SSLEngine on
    #SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
    SSLCipherSuite HIGH:!aNULL:!MD5

    ServerName tt-rss.myserver.net
    ServerAdmin admin@myserver.net
    DocumentRoot /usr/share/webapps/tt-rss

    #SSLCertificateFile /etc/httpd/conf/server.crt
    SSLCertificateFile /etc/letsencrypt/live/myserver.net/fullchain.pem
    #SSLCertificateKeyFile /etc/httpd/conf/server.key
    SSLCertificateKeyFile /etc/letsencrypt/live/myserver.net/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/myserver.net/chain.pem

    <Directory /usr/share/webapps/tt-rss/>
        Options FollowSymlinks
        Require all granted
        AllowOverride all
        #php_admin_value open_basedir none
        php_admin_value open_basedir "/var/lib/tt-rss:/usr/share/webapps/tt-rss:/etc/webapps/tt-rss:/srv/http"
    </Directory>

    PHPINIDir /etc/webapps/tt-rss

    ErrorLog /var/log/httpd/tt-rss.info-error_log
    CustomLog /var/log/httpd/tt-rss.info-access_log common

</VirtualHost>

<VirtualHost *:80>
    ServerName tt-rss.myserver.net
    ServerAdmin admin@myserver.net
    DocumentRoot /usr/share/webapps/tt-rss
    Redirect permanent tt-rss.myserver.net https://tt-rss.myserver.net/
</VirtualHost>

And there is the culprit:

 PHPINIDir /etc/webapps/tt-rss

I just deleted it. It was in my config commented out before.
I must have introduced this error from an old config while merging configs between updated-to php8 and then newly installed php7 compatibility packages. Thank you very very much hoerbert. I was looking through logs for ages and tried a lot of different configs (already thought I totally messed up my setup, and I kind of did, just not totally)

You made my day. Thanks! smile

watnuss

Offline

Board footer

Powered by FluxBB