运行网站(Laravel 5.1,Ubuntu 14.04,PHP 7,mysql 5.7)。它工作正常,直到昨天,当我在尝试注册用户时开始收到以下消息:
Connector.php第55行中的PDOException:找不到驱动程序。
1. in Connector.php line 55
2. at PDO->__construct('mysql:host=localhost;dbname=db_name', 'user_name', 'Pwd', array('0', '2', '0', false, false)) inConnector.php line 55
3. at Connector->createConnection('mysql:host=localhost;dbname=db_name', array('driver'
=> 'mysql', 'host' => 'localhost', 'database' => 'db_name', 'username' => 'user_name', 'password' => 'Pwd', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql'), array('0', '2', '0', false, false)) in MySqlConnector.php line 22
4. at MySqlConnector->connect(array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'db_name', 'username' => 'user_name', 'password' => 'Pwd', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql')) in compiled.php line 11418
5. at ConnectionFactory->createSingleConnection(array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'db_name', 'username' => 'user_name', 'password' => 'Pwd', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql')) in compiled.php line 11414
6. at ConnectionFactory->make(array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'db_name', 'username' => 'user_name', 'password' => 'Pwd', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false), 'mysql') incompiled.php line 11329
7. at DatabaseManager->makeConnection('mysql') in compiled.php line 11284
8. at DatabaseManager->connection(null) in DatabasePresenceVerifier.php line 107
9. at DatabasePresenceVerifier->table('users') in DatabasePresenceVerifier.php line 47
10. at DatabasePresenceVerifier->getCount('users', 'email', 'testy@testymctesterson2.com', null, null, array()) in Validator.php line 1070
11. at Validator->validateUnique('email', 'testy@testymctesterson2.com', array('users'), object(Validator)) in Validator.php line 362
12. at Validator->validate('email', 'unique:users') in Validator.php line 314
13. at Validator->passes() in Validator.php line 335
14. at Validator->fails() in AuthController.php line 82
15. at AuthController->postRegister(object(Request))
16. at call_user_func_array(array(object(AuthController), 'postRegister'), array(object(Request))) in compiled.php line 8880
17. at Controller->callAction('postRegister', array(object(Request))) in compiled.php line 8949
18. at ControllerDispatcher->call(object(AuthController), object(Route), 'postRegister') in compiled.php line 8929
19. at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
20. at call_user_func(object(Closure), object(Request)) in compiled.php line 9600
21. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in RedirectIfAuthenticated.php line 41
22. at RedirectIfAuthenticated->handle(object(Request), object(Closure))
23. at call_user_func_array(array(object(RedirectIfAuthenticated), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9592
24. at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
25. at call_user_func(object(Closure), object(Request)) in compiled.php line 9582
26. at Pipeline->then(object(Closure)) in compiled.php line 8930
27. at ControllerDispatcher->callWithinStack(object(AuthController), object(Route), object(Request), 'postRegister') in compiled.php line 8915
28. at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\Auth\AuthController', 'postRegister') in compiled.php line 7864
29. at Route->runWithCustomDispatcher(object(Request)) in compiled.php line 7835
30. at Route->run(object(Request)) in compiled.php line 7488
31. at Router->Illuminate\Routing\{closure}(object(Request))
32. at call_user_func(object(Closure), object(Request)) in compiled.php line 9600
33. at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
34. at call_user_func(object(Closure), object(Request)) in compiled.php line 9582
35. at Pipeline->then(object(Closure)) in compiled.php line 7489
36. at Router->runRouteWithinStack(object(Route), object(Request)) in compiled.php line 7477
37. at Router->dispatchToRoute(object(Request)) in compiled.php line 7462
38. at Router->dispatch(object(Request)) in compiled.php line 2307
39. at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
40. at call_user_func(object(Closure), object(Request)) in compiled.php line 9600
41. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 2925
php ini看起来像这样:
Configuration File (php.ini) Path: /etc/php/7.0/cli Loaded Configuration File: /etc/php/7.0/cli/php.ini Scan for additional .ini files in: /etc/php/7.0/cli/conf.d Additional .ini files parsed: /etc/php/7.0/cli/conf.d/10-mysqlnd.ini, /etc/php/7.0/cli/conf.d/10-opcache.ini, /etc/php/7.0/cli/conf.d/10-pdo.ini, /etc/php/7.0/cli/conf.d/15-xml.ini, /etc/php/7.0/cli/conf.d/20-calendar.ini, /etc/php/7.0/cli/conf.d/20-ctype.ini, /etc/php/7.0/cli/conf.d/20-curl.ini, /etc/php/7.0/cli/conf.d/20-dom.ini, /etc/php/7.0/cli/conf.d/20-exif.ini, /etc/php/7.0/cli/conf.d/20-fileinfo.ini, /etc/php/7.0/cli/conf.d/20-ftp.ini, /etc/php/7.0/cli/conf.d/20-gettext.ini, /etc/php/7.0/cli/conf.d/20-iconv.ini, /etc/php/7.0/cli/conf.d/20-json.ini, /etc/php/7.0/cli/conf.d/20-mbstring.ini, /etc/php/7.0/cli/conf.d/20-mysqli.ini, /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini, /etc/php/7.0/cli/conf.d/20-phar.ini, /etc/php/7.0/cli/conf.d/20-posix.ini, /etc/php/7.0/cli/conf.d/20-readline.ini, /etc/php/7.0/cli/conf.d/20-shmop.ini, /etc/php/7.0/cli/conf.d/20-simplexml.ini, /etc/php/7.0/cli/conf.d/20-sockets.ini, /etc/php/7.0/cli/conf.d/20-sysvmsg.ini, /etc/php/7.0/cli/conf.d/20-sysvsem.ini, /etc/php/7.0/cli/conf.d/20-sysvshm.ini, /etc/php/7.0/cli/conf.d/20-tokenizer.ini, /etc/php/7.0/cli/conf.d/20-wddx.ini, /etc/php/7.0/cli/conf.d/20-xmlreader.ini, /etc/php/7.0/cli/conf.d/20-xmlwriter.ini, /etc/php/7.0/cli/conf.d/20-xsl.ini
和 /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini有一行:
延长= pdo_mysql.so
Artisan tinker工作正常,可以访问和写入数据库。
我们最近升级了mysql,但是在这个开始发生的前几天,我不知道服务器上可能发生什么变化导致了这个错误。