gpt4 book ai didi

php - 使用 EasyApache4 在 CENTOS 6.9 上启用 PDO 模块

转载 作者:行者123 更新时间:2023-11-29 18:36:33 26 4
gpt4 key购买 nike

我已经使用 EasyApache4 在 Centos 6.9 上运行的 VPS 服务器上安装了 7.1.7-1.1.1.cpanel7.0.21-1.1.1.cpanel。我有一个 Laravel API 和一个 Angular4 应用程序,我想在服务器上运行它们,但我在让 PHP 正常运行时遇到问题。使用 git 安装网站后出现错误;

could not find driver (SQL: select * from site_menu_placements whereactive = 1)

我检查了 error_log,发现以下内容对我来说没有多大意义;

[22-Jul-2017 00:57:11 UTC] PHP Warning:  Module 'pdo_sqlite' already loaded in Unknown on line 0
[22-Jul-2017 00:57:11 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_mbstring.dll' - /opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_mbstring.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo.dll' - /opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_firebird.dll' - /opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_firebird.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_informix.dll' - /opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_informix.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_mssql.dll' - /opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_mssql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_mysql.dll' - /opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_mysql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_oci.dll' - /opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_oci.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_oci8.dll' - /opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_oci8.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_odbc.dll' - /opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_odbc.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_pgsql.dll' - /opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_pgsql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_sqlite.dll' - /opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_pdo_sqlite.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: Module 'PDO' already loaded in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php71/root/usr/lib64/php/modules/pdo_mysql.so' - /opt/cpanel/ea-php71/root/usr/lib64/php/modules/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: Module 'pdo_sqlite' already loaded in Unknown on line 0
[22-Jul-2017 00:57:35 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_mbstring.dll' - /opt/cpanel/ea-php71/root/usr/lib64/php/modules/php_mbstring.dll: cannot open shared object file: No such file or directory in Unknown on line 0

我认为该错误对应于 php_pdo_mysql.dll 没有正常运行。我检查了 phpinfo() 并发现主 php.ini 文件位于 /opt/cpanel/ea-php71/root/etc 我尝试在此文件中加载 PDO 模块,但使用即使我有也没有效果;

extension=pdo.so
extension=pdo_mysql.so
extension=pdo_sqlite.so
extension=mysql.so

当我查看 phpinfo() 页面时,我可以看到有一个名为“PDO”的部分,但在该部分中我只在 PDO 驱动程序行中看到 sqlite。我相信我也应该看到 mysql。

当我通过 ssh 运行 php artisan migrate 时,出现以下错误;

[Doctrine\DBAL\Driver\PDOException] could not find driver

[PDOException] could not find driver

我认为应该包含 pdo mysql 驱动程序的软件包是 ea-php71-php-pdo-7.1.7-1.1.6.cpanel.x86_64 我已经使用了 rpm - ql ea-php71-php-pdo-7.1.7-1.1.6.cpanel.x86_64 找出它的安装位置,我得到以下信息;

/opt/cpanel/ea-php71/root/etc/php.d/20-pdo.ini
/opt/cpanel/ea-php71/root/etc/php.d/20-sqlite3.ini
/opt/cpanel/ea-php71/root/etc/php.d/30-pdo_sqlite.ini
/opt/cpanel/ea-php71/root/usr/lib64/php/modules/pdo.so
/opt/cpanel/ea-php71/root/usr/lib64/php/modules/pdo_sqlite.so
/opt/cpanel/ea-php71/root/usr/lib64/php/modules/sqlite3.so

所以 pdo_mysql 丢失了。

最佳答案

按照说明进行操作:

第 1 步:在命令行上运行 pecl install pdo

第2步: 如果已经安装,只需编辑/etc/php.ini

第 3 步:添加以下行

; Extension PDO
extension=pdo.so

第二种方式:

首先安装php-mysql

sudo apt-get install php7.0-mysql

然后启用模块

sudo phpenmod pdo_mysql

并重新启动apache

sudo service apache2 restart 

希望对您有帮助。

关于php - 使用 EasyApache4 在 CENTOS 6.9 上启用 PDO 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45249705/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com