Problems with PHP, CLI, PDO in LAMP stackscript configuratio
When I run a php script with apache php, all its ok, but when I run this script with PHP CLI, I always get this error:
php -qn -d memory_limit=128M script.php
Fatal error: Class 'PDO' not found in script.php on line 51
But PDO is enabled in all php runtimes configurations (apache and cli).
If I run:
php –ini
I get:
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File: /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed: /etc/php5/cli/conf.d/curl.ini,
/etc/php5/cli/conf.d/gd.ini,
/etc/php5/cli/conf.d/mcrypt.ini,
/etc/php5/cli/conf.d/mysql.ini,
/etc/php5/cli/conf.d/mysqli.ini,
/etc/php5/cli/conf.d/pdo.ini,
/etc/php5/cli/conf.d/pdo_mysql.ini
So, php CLI has pdo.ini loaded.
Any suggestion?
It could be a permissions issue, related with pdo.so module?
thanks in advance
4 Replies
What's in /etc/php5/cli/conf.d/mysqli.ini, pdo.ini and pdo_mysql.ini?
php -r "phpinfo();"
PDO
PDO support => enabled
PDO drivers => mysql
pdo_mysql
PDO Driver for MySQL => enabled
Client API version => 5.5.37
Directive => Local Value => Master Value
pdomysql.defaultsocket => /var/run/mysqld/mysqld.sock => /var/run/mysqld/mysqld.sock
mysqli.ini contains:
extension=mysqli.so
pdo.ini:
extension=pdo.so
pdo_mysql.ini:
extension=pdo_mysql.so
Thanks again
php -qn -d memory_limit=128M script.php
-n tells php runtime to not use ini file.
Thank you for your time