Typecho博客搬家后遗症

非常喜欢typecho的小巧,速度也很好,我喜欢用它来做照片墙,不单是一个相册,附上自己心语,会更让岁月鎏金。

今天搬家了,我用的是

wget -N --no-check-certificate git.io/c.sh && chmod +x c.sh && bash c.sh

的一键包,里边有个非常方便的一键备份功能

打包后是个zip,里边包含了数据库,搬到新家后,发现网页浏览正常,但是无法进入后台,提示Database Query Error

我先找到了这个网页:

https://www.typechodev.com/case/Typecho%E6%95%B0%E6%8D%AE%E5%BA%93%E9%94%99%E8%AF%AFDatabase-Query-Error%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95.html

里边提到了一个很有用的方法,就是修改index.php,以便输出debug信息,

1. 在index.php中加入define('__TYPECHO_DEBUG__',true);,打开typecho调试模式

#file: index.php
define('__TYPECHO_DEBUG__',true);//add by https://www.typechodev.com

2.然后再次访问出错的页面,可以看到如下详细的错误信息

我试着捣鼓了一下,得到了一条有用的出错信息:

SQLSTATE[HY000]: General error: 8 attempt to write a readonly database

再把这条出错信息放到网上去搜,找到了这个网页:

https://stackoverflow.com/questions/47835714/laravel-sqlite-sqlstatehy000general-error-8-attempt-to-write-a-readonly-d

8

You need to run two commands

First, change ownership of the Laravel directory to web group:

sudo chown -R :www-data /var/www/yourLarvelFolder

Second, give privileges over storage directory so it can be writable:

sudo chmod -R 775 /var/www/yourLarvelFolder/storage

这个方案非常眼熟,我觉得非常靠谱,于是乎:

chown -R :www-data *
chmod -R 775 *

终于解决了,安全进入后台

另附上一个链接,更改typecho文件上传体积大小的限制:

https://www.polarxiong.com/archives/typecho%E4%B8%AD%E4%BF%AE%E6%94%B9%E4%B8%8A%E4%BC%A0%E9%99%84%E4%BB%B6%E5%A4%A7%E5%B0%8F%E9%99%90%E5%88%B6.html

我实际更改了/etc/php/7.0/fpm/php.ini里边的:

upload_max_filesize = 1000M;
post_max_size = 1000M;
max_execution_time=600;

这三项,然后重启

怎么知道php在用哪个ini呢?简单方法:

php  --ini
点赞

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注