当我安装 pdo-pgsql 时,扩展被安装到 中/usr/lib/php/extensions/no-debug-non-zts-20090626/
,因此不会自动加载。在 中php.ini
,我extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626"
已经定义了。
摘录php.ini
; Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626"
zend_extension = "/usr/local/IonCube/ioncube_loader_lin_5.3.so"
zend_extension = "/usr/local/Zend/lib/Guard-5.5.0/php-5.3.x/ZendGuardLoader.so"
extension = "eaccelerator.so"
extension = "pdo.so"
extension = "pdo_pgsql.so"
extension = "pdo_sqlite.so"
extension = "sqlite.so"
extension = "pdo_mysql.so"
修改后即可使用
; Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626"
extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20090626"
zend_extension = "/usr/local/IonCube/ioncube_loader_lin_5.3.so"
zend_extension = "/usr/local/Zend/lib/Guard-5.5.0/php-5.3.x/ZendGuardLoader.so"
extension = "eaccelerator.so"
extension = "pdo.so"
extension = "pdo_pgsql.so"
extension = "pdo_sqlite.so"
extension = "sqlite.so"
extension = "pdo_mysql.so"
为什么 PECL 将 pdo-pgsql 安装到第二个扩展目录中而不是第一个?
是否建议使用
extension_dir
上面第二个代码片段所示的 2 个?
答案1
因为它是通过 安装时的默认位置
pecl install
,而如果从源代码编译 PHP,则扩展路径应该是/usr/local/lib/php/extensions/no-debug-non-zts-20090626
。据我所知,PHP 不支持多个
extension_dir
,它只选择最后一个。只需输入php -i | grep eaccelerator
即可查看会发生什么。
解决方法是将扩展复制到正确的路径。