Score:0

PHP not finding extensions in the correct directory

ru flag

Sorry if this is a repeat of another question; my searches failed to find a direct solution to my problem.

Just now, my machine updated PHP to v8.2. Since then, I have been unable to run the SQL Server extension.

After some trial and error, I got the INI files copied to the new folder, as confirmed by php -i (trimmed for brevity):

/etc/php/8.2/cli/conf.d/20-sockets.ini,
/etc/php/8.2/cli/conf.d/20-sqlsrv.ini,
/etc/php/8.2/cli/conf.d/20-sysvmsg.ini,
...
/etc/php/8.2/cli/conf.d/20-xsl.ini,
/etc/php/8.2/cli/conf.d/30-pdo_sqlsrv.ini

When I run php -i, this warning appears:

PHP Warning:  PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /usr/lib/php/20220829/sqlsrv.so (/usr/lib/php/20220829/sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20220829/sqlsrv.so.so (/usr/lib/php/20220829/sqlsrv.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_sqlsrv.so' (tried: /usr/lib/php/20220829/pdo_sqlsrv.so (/usr/lib/php/20220829/pdo_sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20220829/pdo_sqlsrv.so.so (/usr/lib/php/20220829/pdo_sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Okay... I can find the files manually:

/usr/lib/php find . -name sqlsrv*
./20210902/sqlsrv.so
/usr/lib/php find . -name pdo_sqlsrv*
./20210902/pdo_sqlsrv.so

Clearly they aren't where PHP is looking for them. But how do I make PHP find them?

Score:0
in flag

The problem is that the extensions

sockets, sqlsrv, sysvmsg, xsl, pdo_sqlsrv

are not installed for php 8.2.

Please install them, probably by doing

sudo apt-get install php8.2-sockets
etc

Each php version has its own .so extension directory under /usr/lib/php/

enter image description here

In each folder there are compiled versions of extensions for each php version.

A compiled extension(.so file) will not work with a different php version.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.