thinkphp Class 'PDO' not found 錯誤,緣由mysql5.7.26缺乏pdo驅動,須要安裝php的pdo和pdo_mysql擴展php
本文以centOS爲例html
cd ext/pdomysql
2.執行/usr/local/php/bin/phpize[假設PHP的安裝目錄爲/usr/local/php]nginx
/usr/local/php/bin/phpize --with-php-config=/usr/local/php/bin/php-configsql
3.配置擴展pdothinkphp
./configure --with-php-config=/usr/local/php/bin/php-config --enable-pdo=sharedspa
4.編譯安裝pdodebug
make && make installhtm
成功則出現blog
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
Installing header files: /usr/local/php/include/php/
Installing PDO headers: /usr/local/php/include/php/ext/pdo/
說明在/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/目錄下生成了pdo.so文件
6.在php配置文件中加上
extension=」/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/pdo.so」
7.在PHP源碼包中進入pdo_mysql
cd ext/pdo_mysql
8.執行/usr/local/php/bin/phpize --with-php-config=/usr/local/php/bin/php-config
9.配置pdo_mysql[假設Mysql的安裝目錄爲/usr/local/mysql]
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
10.編譯pdo_mysql 安裝pdo_mysql
make && make install
成功則出現
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
說明的/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/目錄下生成了pdo_mysql.so文件
12.在php配置文件中加上
extension=」/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so」
重啓php和(nginx或Apache)便可!