在宅基地安装php 7后出现PDO连接错误

时间:2017-01-17 08:53:16

标签: php mysql laravel nginx pdo

我使用本指南https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-php-7-on-ubuntu-14-04升级到宅基地的php 7。但现在我正在尝试在我的laravel应用程序中运行迁移和其他数据库内容,它说:

Next Illuminate\Database\QueryException: could not find driver (SQL: SELECT * from `USERS`) in /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Database/Connection.php:770
Stack trace:
#0 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Database/Connection.php(726): Illuminate\Database\Connection->runQueryCallback('SELECT * from `...', Array, Object(Closure))
#1 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Database/Connection.php(351): Illuminate\Database\Connection->run('SELECT * from `...', Array, Object(Closure))
#2 /home/vagrant/Code/tenant-application/tenant-package/src/Commands/SyncUsersToRedis.php(50): Illuminate\Database\Connection->select('SELECT * from `...')
#3 [internal function]: Uppdragshuset\AO\Tenant\Commands\SyncUsersToRedis->handle()
#4 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Container/Container.php(508): call_user_func_array(Array, Array)
#5 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Console/Command.php(169): Illuminate\Container\Container->call(Array)
#6 /home/vagrant/Code/tenant-application/vendor/symfony/console/Command/Command.php(261): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Console/Command.php(155): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /home/vagrant/Code/tenant-application/vendor/symfony/console/Application.php(817): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /home/vagrant/Code/tenant-application/vendor/symfony/console/Application.php(185): Symfony\Component\Console\Application->doRunCommand(Object(Uppdragshuset\AO\Tenant\Commands\SyncUsersToRedis), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /home/vagrant/Code/tenant-application/vendor/symfony/console/Application.php(116): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(121): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /home/vagrant/Code/tenant-application/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 {main}  

我已经尝试了sudo apt-get install php7.0-mysql并安装得很好。我也重新加载了nginx和php。

phpinfo也很好。我猜。

PDO information

laravel中的Mysql配置

'mysql' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST', 'localhost'),
            'port'      => env('DB_PORT', 3306),
            'database'  => env('DB_DATABASE', 'forge'),
            'username'  => env('DB_USERNAME', 'forge'),
            'password'  => env('DB_PASSWORD', ''),
            'port'      => env('DB_PORT', 3306),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ],

Nginx文件:

access_log off;
error_log  /var/log/nginx/tenant-testing.app-error.log error;

sendfile off;

client_max_body_size 100m;

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_intercept_errors off;
    fastcgi_buffer_size 16k;
    fastcgi_buffers 4 16k;
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
}

location ~ /\.ht {
    deny all;
}

ssl_certificate     /etc/nginx/ssl/tenant-testing.app.crt;
ssl_certificate_key /etc/nginx/ssl/tenant-testing.app.key;

}

0 个答案:

没有答案