我在使用EasyApache4在Centos 6.9上运行的VPS服务器上安装了7.1.7-1.1.1.cpanel
和7.0.21-1.1.1.cpanel
。我有一个laravel API和一个angular4应用程序,我想在服务器上运行,但我有问题让PHP运行正常。使用git安装网站后,我收到错误;
找不到驱动程序(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]找不到驱动程序
[PDOException]找不到驱动程序
我认为应该包含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。
答案 0 :(得分:0)
按照说明操作:
步骤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
希望它会有所帮助。