marty001 发表于 2018-12-13 08:05:43

php连接数据库提示could not find driver 问题解决

使用命令可以链接,编写个php连接mysql的测试页面也是可以连接的,但php程序就是无法连接,报一下错误:
  could not find driver
  提示:未找到驱动
  

  解决方法:

[*]  cd /usr/src/php-5.5.38/ext/pdo_mysql
[*]  phpize
[*]  ./configure --with-php-config=/usr/local/php5/bin/php-config
[*]  make
[*]  make install
  此时将会生成模块(pdo_mysql.so),路径会打印到屏幕上,将路径加模块一同写入到php.ini
  6. vim /usr/local/php/php.ini
  extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212/pdo_mysql.so
  7. 重启服务:/etc/init.d/httpd restart




页: [1]
查看完整版本: php连接数据库提示could not find driver 问题解决