PHPBB3 Both the database and the directory containing it must be writable -- 含解题过程

解题:我用的是SQLite数据库,原因是没有填对数据库路径,
Database server name: /var/www/html/phpBB3/db

解题过程:

1.Google Both the database and the directory containing it must be writable
发现 https://fossies.org/linux/phpBB/language/en/install.php中有以下内容
'INST_ERR_DB_NO_WRITABLE' => 'Both the database and the directory containing it must be writable.',

2.在安装包目录查找INST_ERR_DB_NO_WRITABLE

grep -ir "INST_ERR_DB_NO_WRITABLE" phpBB3/*
找到:/var/www/html/phpBB3/phpbb/install/helper/database.php

    // Check if SQLite database is writable
    if ($dbms_info['SCHEMA'] === 'sqlite'
        && (($this->filesystem->exists($dbhost) && !$this->filesystem->is_writable($dbhost)) || !$this->filesystem->is_writable(pathinfo($dbhost, PATHINFO_DIRNAME))))
    {
        $errors[] = array(
            'title' =>'INST_ERR_DB_NO_WRITABLE',
        );
    }

就以为是填localhost,又以为是填localhost/phpBB3/db 都不对,虽然安装成功,到后面点击ACP访问管理后台时报错:

General Error
SQL ERROR [ sqlite3 ]
no such table: phpbb_config [1]
An sql error occurred while fetching this page. Please contact an administrator if this problem persists.

3.又Google no such table: phpbb_config 没有找到答案.

4.再看database.php这段代码this->filesystem->is_writable($dbhost)
灵机一动,dbhost应该是本地的一个路径,我在phpBB3里新建了一个db目录就可以了.
安装时填写Database server name为/var/www/html/phpBB3/db

 

 5.大功告成:http://localhost/phpBB3/

 

posted @ 2020-12-25 21:03  船长博客  阅读(186)  评论(0编辑  收藏  举报
永远相信美好的事情即将发生!