Hey Stackoverflow Community,
I am currently in the process of trying to integrate a PostgreSQL database into a PHP application. (Am still very much a beginner in both).
When I run php -m
, it lists a very long list of extensions/modules which are allegedly installed, such as pdo_pgsql
. (The extension I wish to use).
However, when I edit my php.ini file and uncomment the extension=pdo_pgsql
line, enabling the extension, PHP will start throwing errors at me constantly: PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_pgsql' (tried: /usr/local/lib/php/pecl/20230831/pdo_pgsql
.
Obviously, the problem here is that my php.ini file is stating extension_dir="/usr/local/lib/php/pecl/20230831"
, and even from looking there myself, that folder is empty.
Thus, my question is, are the extensions/modules which the php -m
command said are installed actually installed? If so, where could they be found (so that I can point my php.ini
file’s extension_dir
line there).
I am running macOS Sonoma 14.5, and I installed PHP using Homebrew, it is version 8.3.8.
I have tried using the UNIX terminal command find . -name "*pgsql*" -exec ls -ld {} ;
to search for the extension, yet have found nothing. (Also ChatGPT proved to be useless)
FYI running php -m
returns
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_dblib
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
pq
pspell
random
raphf
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
And the full error which PHP gives me is
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_pgsql' (tried: /usr/local/lib/php/pecl/20230831/pdo_pgsql (dlopen(/usr/local/lib/php/pecl/20230831/pdo_pgsql, 0x0009): tried: '/usr/local/lib/php/pecl/20230831/pdo_pgsql' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/php/pecl/20230831/pdo_pgsql' (no such file), '/usr/local/lib/php/pecl/20230831/pdo_pgsql' (no such file)), /usr/local/lib/php/pecl/20230831/pdo_pgsql.so (dlopen(/usr/local/lib/php/pecl/20230831/pdo_pgsql.so, 0x0009): tried: '/usr/local/lib/php/pecl/20230831/pdo_pgsql.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/php/pecl/20230831/pdo_pgsql.so' (no such file), '/usr/local/lib/php/pecl/20230831/pdo_pgsql.so' (no such file))) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'pdo_pgsql' (tried: /usr/local/lib/php/pecl/20230831/pdo_pgsql (dlopen(/usr/local/lib/php/pecl/20230831/pdo_pgsql, 0x0009): tried: '/usr/local/lib/php/pecl/20230831/pdo_pgsql' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/php/pecl/20230831/pdo_pgsql' (no such file), '/usr/local/lib/php/pecl/20230831/pdo_pgsql' (no such file)), /usr/local/lib/php/pecl/20230831/pdo_pgsql.so (dlopen(/usr/local/lib/php/pecl/20230831/pdo_pgsql.so, 0x0009): tried: '/usr/local/lib/php/pecl/20230831/pdo_pgsql.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/php/pecl/20230831/pdo_pgsql.so' (no such file), '/usr/local/lib/php/pecl/20230831/pdo_pgsql.so' (no such file))) in Unknown on line 0
[PHP Modules]