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

博客记录了phpBB数据库安装过程中的问题及解决办法。安装时提示数据库和目录需可写,查找相关代码后,起初填写地址错误,安装虽成功但访问管理后台报错。最终发现dbhost应是本地路径,新建db目录并填写对应路径后安装成功。
解题:我用的是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/

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值