Dominic Fagan Dominic Fagan - 18 days ago 5
PHP Question

PHP - Extensions are loaded, but not loaded in command line

I've seen this happen with a number of extensions now. So I need the php_pdo_pgsql extension, and its definitely loaded. Heres the lines in php.ini:

extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll


enter image description here

The .dll files are in the ext directory. But from the command line:

PS C:\wamp64\www\spider\chebi> php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imap
intl
json
ldap
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
odbc
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib

[Zend Modules]


Its not in there. Got the same problem with xdebug. Does anyone know whats happening here? Is it something to do with the environment variables?

Answer

Usually there are 2 different PHP configuration file(php.ini) files. One for the CLI (Command line client) and one for server(APACHE).

You should use -c to specify path to php.ini file you want to use.

You can check details using php --help on cmd