【数据库连接不上。请确保安装了php-sqlite扩展以及数据库文件Sqlite/showdoc.db.php可用】解决方案

环境

系统:Windows 10
容器:httpd-2.4.48-win64-VS16
语言:php-8.0.8-Win32-vs16-x64
工程:showdoc-master

配置

php.ini 开放扩展模块如下

extension_dir = "c:/php/ext"
extension=curl
extension=gd
extension=mbstring
extension=pdo_sqlite
extension=sqlite3
sqlite3.extension_dir = "c:/php/ext"

httpd.conf
添加index.php默认文档


    DirectoryIndex index.html index.php
</IfModule>

添加配置


LoadModule php_module 'c:/php/php8apache2_4.dll'

PHPIniDir 'c:/php'

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Alias /showdoc "d:/git/showdoc"
"d:/git/showdoc">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

问题

打开showdoc登录页面,点击登录,提示【数据库连接不上。请确保安装了php-sqlite扩展以及数据库文件Sqlite/showdoc.db.php可用】错误

原因

未成功加载Sqlite3模块
验证方法:添加测试文件phpinfo.php

();
?>

可以看到PDO drivers值为空

解决

【数据库连接不上。请确保安装了php-sqlite扩展以及数据库文件Sqlite/showdoc.db.php可用】解决方案

本人PHP小白一枚,只试出这种解决方案,如果有更好的方法,欢迎沟通。

Original: https://blog.csdn.net/u010534123/article/details/119061428
Author: jk553633
Title: 【数据库连接不上。请确保安装了php-sqlite扩展以及数据库文件Sqlite/showdoc.db.php可用】解决方案

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/816655/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球