2017-02-10 167 views
4

我面临一个我无法解决的问题。我使用Ubuntu 16.04,PHP 7.1,MySQL和NGINX在我的服务器上托管了我的应用程序。我的应用完美。当我SSH我的服务器和应用程序根我运行以下,PHP工匠会议:表,它运行成功。Laravel 5.4迁移错误

当我运行php工匠迁移时,我得到foll0wing错误,并没有在我的数据库中创建表。

[Illuminate\Database\QueryException]           
    could not find driver (SQL: select * from information_schema.tables where t 
    able_schema = UNIT3D and table_name = migrations)        

    [PDOException]   
    could not find driver 

任何想法?我试图使用这个。 https://github.com/thomastkim/laravel-online-users

回答

12

我会从确定安装的确切php模块开始。这可以通过

php -m 

寻找'phpX.Y-mysql',如果你没有看到它,那么PHP模块没有安装。 (其中xy符合您的PHP版本号

假设你没有看到它,你可以通过键入找到从回购安装的确切包版本:

sudo apt-cache search php-mysql 

您的结果将类似于:

sudo apt-cache search php-mysql 
php-mysql - MySQL module for PHP [default] 
php7.0-mysql - MySQL module for PHP 
php5.6-mysql - MySQL module for PHP 
php-mysqlnd-ms - MySQL replication and load balancing module for PHP 
php7.1-mysql - MySQL module for PHP 

为您的版本安装合适的PHP模块例:

sudo apt-get install php7.1-mysql 
+0

是原来w ^母鸡我升级到php7.1我忘了安装模块 'sudo apt-get安装php7.1-php-mysql' 谢谢 –

+0

'sudo apt-get install php-mysql'自动选择正确的php版本 – BetaRide