Zend Server 8 PDO 无法通过 CLI 找到驱动程序
Zend Server 8 PDO could not find driver via CLI
我安装了 Zend Server 8,我需要通过命令行 运行 使用 MySQL 的脚本。
当我 运行 我的一个 CLI 脚本时出现此错误:
PDOException
could not find driver
但是通过 http 一切正常,问题只出现在 CLI 中。我知道 CLI 有一个不同的 php.ini
。但是,当我像这样引用服务器用于 http 的 php.ini
时:
php -c/usr/local/zend/etc/php.ini my-script
我明白了:
Warning: PHP Startup: Unable to load dynamic library
/usr/local/zend/lib/php_extensions/pdo.so' -
/usr/local/zend/lib/php_extensions/pdo.so:
cannot open shared object file:
No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library /usr/local/zend/lib/php_extensions/readline.so' - /usr/local/zend/lib/php_extensions/readline.so:
cannot open shared object file:
No such file or directory in Unknown on line 0
Fatal error: Class 'PDO' not found in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php on line 155
我不知道如何解决这个问题。如果有区别,我会使用 Ubuntu 14.04
。
说我首先像这样安装 LAMP 可能也很有用:
sudo apt-get install lamp-server^
然后我安装了 Zend Server
有什么建议吗?
谢谢。
我最终只是将 php
别名更改为 Zend Server
安装的 php
,如下所示:
alias php=/usr/local/zend/bin/php
这似乎可行,但仍在寻找 better/proper 解决方案。
我安装了 Zend Server 8,我需要通过命令行 运行 使用 MySQL 的脚本。
当我 运行 我的一个 CLI 脚本时出现此错误:
PDOException
could not find driver
但是通过 http 一切正常,问题只出现在 CLI 中。我知道 CLI 有一个不同的 php.ini
。但是,当我像这样引用服务器用于 http 的 php.ini
时:
php -c/usr/local/zend/etc/php.ini my-script
我明白了:
Warning: PHP Startup: Unable to load dynamic library
/usr/local/zend/lib/php_extensions/pdo.so' -
/usr/local/zend/lib/php_extensions/pdo.so:
cannot open shared object file:
No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library /usr/local/zend/lib/php_extensions/readline.so' - /usr/local/zend/lib/php_extensions/readline.so:
cannot open shared object file:
No such file or directory in Unknown on line 0
Fatal error: Class 'PDO' not found in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php on line 155
我不知道如何解决这个问题。如果有区别,我会使用 Ubuntu 14.04
。
说我首先像这样安装 LAMP 可能也很有用:
sudo apt-get install lamp-server^
然后我安装了 Zend Server
有什么建议吗?
谢谢。
我最终只是将 php
别名更改为 Zend Server
安装的 php
,如下所示:
alias php=/usr/local/zend/bin/php
这似乎可行,但仍在寻找 better/proper 解决方案。