You are not logged in.

#1 2024-01-04 12:54:40

jojo06
Member
Registered: 2023-11-04
Posts: 233

[SOLVED]Some PHP Problems about mysqli and pdo

In phpinfo it shows that there is no PDO support / driver. I cannot use PDO connection on localhost. I cannot debug in VSC.
I activated extension mysqli and everything like that (by deleting ; semicolon at the beginning). But it still shows problems.

I don't know if it is due to the updates, if I am not mistaken, I noticed something like this: When I opened the php.ini file again and looked at it, some extensions were put back in the comment line with a semicolon. mysqli, pdo and anything similar to these names, I removed the ; at the beginning of all of them.

Current:

extension=mysqli
extension=mysql
extension=mysqli.so
extension=pdo_dblib
extension=pdo_mysql
extension=pdo.so
extension=pdo_odbc
extension=pdo_pgsql
extension=pdo_sqlite
extension=/usr/lib/php/modules/mysqli.so

As far as I can tell from the descriptions, I didn't open them because it might be a problem and I don't need to, but as you can see, everything else is very active and installed. 

;mysqli.rollback_on_cached_plink = Off
;mysqlnd.debug =
;mysqlnd.log_mask = 0
;mysqlnd.mempool_default_size = 16000
;mysqlnd.net_cmd_bufer_size = 2048
;mysqlnd.net_read_buffer_size = 32768
;mysqlnd.net_read_timeout = 31536000
;mysqlnd.sha256_server_public_key =

php --ini

PHP Warning:  PHP Startup: Unable to load dynamic library 'mysqli' (tried: ext/mysqli (ext/mysqli: cannot open shared object file: No such file or directory), ext/mysqli.so (ext/mysqli.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 'pdo_dblib' (tried: ext/pdo_dblib (ext/pdo_dblib: cannot open shared object file: No such file or directory), ext/pdo_dblib.so (ext/pdo_dblib.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 'pdo_mysql' (tried: ext/pdo_mysql (ext/pdo_mysql: cannot open shared object file: No such file or directory), ext/pdo_mysql.so (ext/pdo_mysql.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 'pdo.so' (tried: ext/pdo.so (ext/pdo.so: cannot open shared object file: No such file or directory), ext/pdo.so.so (ext/pdo.so.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 'pdo_odbc' (tried: ext/pdo_odbc (ext/pdo_odbc: cannot open shared object file: No such file or directory), ext/pdo_odbc.so (ext/pdo_odbc.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 'pdo_pgsql' (tried: ext/pdo_pgsql (ext/pdo_pgsql: cannot open shared object file: No such file or directory), ext/pdo_pgsql.so (ext/pdo_pgsql.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 'pdo_sqlite' (tried: ext/pdo_sqlite (ext/pdo_sqlite: cannot open shared object file: No such file or directory), ext/pdo_sqlite.so (ext/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 'mysqli.so' (tried: ext/mysqli.so (ext/mysqli.so: cannot open shared object file: No such file or directory), ext/mysqli.so.so (ext/mysqli.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Configuration File (php.ini) Path: /etc/php
Loaded Configuration File:         /etc/php/php.ini
Scan for additional .ini files in: /etc/php/conf.d
Additional .ini files parsed:      /etc/php/conf.d/igbinary.ini,
/etc/php/conf.d/redis.ini

php -m output --It shows the same errors as above, I didn't take it. Underneath it:

[PHP Modules]
Core
ctype
date
dom
fileinfo
filter
hash
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
Phar
posix
random
readline
Reflection
session
SimpleXML
SPL
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

[Zend Modules]

ls /usr/lib/php/modules/mysqli.so

/usr/lib/php/modules/mysqli.so

ls /usr/lib/php/modules/pdo_mysql.so

/usr/lib/php/modules/pdo_mysql.so

Thank you for your help.

Last edited by jojo06 (2024-01-05 22:18:23)

Offline

#2 2024-01-04 14:48:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,730
Website

Re: [SOLVED]Some PHP Problems about mysqli and pdo

What's the output of `pacman -Qi php` and `pacman -Qkk php`?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2024-01-04 16:54:27

jojo06
Member
Registered: 2023-11-04
Posts: 233

Re: [SOLVED]Some PHP Problems about mysqli and pdo

Trilby wrote:

What's the output of `pacman -Qi php` and `pacman -Qkk php`?

Thank you for your interest.

pacman -Qi php

Name            : php
Version         : 8.2.14-1
Description     : A general-purpose scripting language that is especially suited to web development
Architecture    : x86_64
URL             : https://www.php.net/
Licenses        : PHP
Groups          : None
Provides        : php-interpreter=8.2  php-intl=8.2.14
Depends On      : libxml2  curl  libzip  pcre2  argon2  oniguruma
Optional Deps   : None
Required By     : php-apache  php-cgi  php-embed  php-fpm  php-gd  php-igbinary  php-snmp  phpmyadmin
Optional For    : libguestfs
Conflicts With  : php-intl
Replaces        : php-intl
Installed Size  : 26.82 MiB
Packager        : Pierre Schmitz <pierre@archlinux.org>
Build Date      : Thu Dec 21 06:02:51 2023
Install Date    : Fri Dec 22 05:41:47 2023
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

pacman -Qkk php

backup file: php: /etc/php/php.ini (Modification time mismatch)
backup file: php: /etc/php/php.ini (Size mismatch)
backup file: php: /etc/php/php.ini (MD5 checksum mismatch)
backup file: php: /etc/php/php.ini (SHA256 checksum mismatch)
php: 410 total files, 0 altered files

Offline

#4 2024-01-04 17:09:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,730
Website

Re: [SOLVED]Some PHP Problems about mysqli and pdo

Oh - I misunderstood your first post.  In your code snippet you listed two `ls` commands that appeared to not have any output, but in reality you just showed the output of the commands after both of them (i.e., out of order / out of context).  You may want to fix that as it's confusing.

Php is trying to load modules from the wrong location - it likely is related to /etc/php/conf.d/igbinary.ini or /etc/php/conf.d/redis.ini.  Please post the output of `pacman -Qkk php-igbinary php-redis` and post or link to the full content of your php.ini (and those other inis if they are changed from the stock default).

Last edited by Trilby (2024-01-04 17:11:56)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2024-01-04 17:26:20

jojo06
Member
Registered: 2023-11-04
Posts: 233

Re: [SOLVED]Some PHP Problems about mysqli and pdo

pacman -Qkk php-igbinary php-redis

php-igbinary: 28 total files, 0 altered files
php-redis: 17 total files, 0 altered files

I only know/remember the php.ini, shouldnt be anyother. Can you please mention some ?
Thank you so much.
https://0x0.st/H64n.ini

Offline

#6 2024-01-04 18:03:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,730
Website

Re: [SOLVED]Some PHP Problems about mysqli and pdo

extension_dir = "ext"

Well there you go, that's the problem.  Did you copy this ini file from a windows machine?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2024-01-04 18:23:08

jojo06
Member
Registered: 2023-11-04
Posts: 233

Re: [SOLVED]Some PHP Problems about mysqli and pdo

Trilby wrote:
extension_dir = "ext"

Well there you go, that's the problem.  Did you copy this ini file from a windows machine?

No it was default. And its strange indeed to, file has many windows modules. If its not defaults, on linux, i might try to download or copy paste some, it was time ago im not quite remember.

When i try to debug, the debug console output changed. Yet PDO(in phpinfo) has no drivers. But (yes, i cleared the console) its still giving me the PHP related warnings about:

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo.so' (tried: /usr/lib/php/modules/pdo.so (/usr/lib/php/modules/pdo.so: cannot open shared object file: No such file or directory), /usr/lib/php/modules/pdo.so.so (/usr/lib/php/modules/pdo.so.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 'pdo_odbc' (tried: /usr/lib/php/modules/pdo_odbc (/usr/lib/php/modules/pdo_odbc: cannot open shared object file: No such file or directory), /usr/lib/php/modules/pdo_odbc.so (/usr/lib/php/modules/pdo_odbc.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 'pdo_pgsql' (tried: /usr/lib/php/modules/pdo_pgsql (/usr/lib/php/modules/pdo_pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/modules/pdo_pgsql.so (/usr/lib/php/modules/pdo_pgsql.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 'pdo_sqlite' (tried: /usr/lib/php/modules/pdo_sqlite (/usr/lib/php/modules/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/modules/pdo_sqlite.so (/usr/lib/php/modules/pdo_sqlite.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  Module "mysqli" is already loaded in Unknown on line 0

Thank you for your help.

Offline

#8 2024-01-05 00:15:01

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,730
Website

Re: [SOLVED]Some PHP Problems about mysqli and pdo

The first error is due to another clearly nonsensical line in your php.ini ("extension=pdo.so").  The others are due to you not having packages installed for extensions that you have enabled in your php.ini.  Do you really want to use all of those extensions?  Are are these also the result of just semi-randomly copy-pasting from other peoples' configs?

Given all these errors, and your apparent lack of knowledge of all the changes to your php.ini, I'd strongly advise you just reset it to the defaults for the package, and only make revisions you know you need.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2024-01-05 00:50:04

jojo06
Member
Registered: 2023-11-04
Posts: 233

Re: [SOLVED]Some PHP Problems about mysqli and pdo

Trilby wrote:

The first error is due to another clearly nonsensical line in your php.ini ("extension=pdo.so").  The others are due to you not having packages installed for extensions that you have enabled in your php.ini.  Do you really want to use all of those extensions?  Are are these also the result of just semi-randomly copy-pasting from other peoples' configs?

Given all these errors, and your apparent lack of knowledge of all the changes to your php.ini, I'd strongly advise you just reset it to the defaults for the package, and only make revisions you know you need.

Resetting it would make a lot of sense, yes. Is there a method other than reinstalling php? I don't need to use all this, no. As I said, I had them all enabled in case there was some kind of deficiency/requirement and if there was a bug due to that. Thinking about it again, though, as far as I remember, no, it's not copy and paste from windows.

I have them in the comment line now, but I still get errors:

PHP Warning:  Module "mysqli" is already loaded in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_dblib' (tried: /usr/lib/php/modules/pdo_dblib (/usr/lib/php/modules/pdo_dblib: cannot open shared object file: No such file or directory), /usr/lib/php/modules/pdo_dblib.so (/usr/lib/php/modules/pdo_dblib.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  Module "mysqli" is already loaded in Unknown on line 0

Thank you very much for your help.

Offline

#10 2024-01-05 01:18:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,730
Website

Re: [SOLVED]Some PHP Problems about mysqli and pdo

curl -sL $(pacman -Sp php) | bsdtar xOf - etc/php/php.ini

That will send the default content to stdout.  You could add something like "| sudo tee /etc/php.ini" to the end to overwrite the current file.

Then follow the wiki to configure php as there are a couple things you are expected to change from the default.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#11 2024-01-05 22:18:08

jojo06
Member
Registered: 2023-11-04
Posts: 233

Re: [SOLVED]Some PHP Problems about mysqli and pdo

Trilby wrote:
curl -sL $(pacman -Sp php) | bsdtar xOf - etc/php/php.ini

That will send the default content to stdout.  You could add something like "| sudo tee /etc/php.ini" to the end to overwrite the current file.

Then follow the wiki to configure php as there are a couple things you are expected to change from the default.

Thanks a lot. Solved.

Offline

Board footer

Powered by FluxBB