最近遇到一个问题是关于wp上建立的网站更换域名和IP后WP出现报错的问题,当时忘记截图了,不过我复制了报错的信息,
ERROR1:
Your site doesn’t have the necessary read/write permissions for your file system to use this plugin. Please contact your hosting provider to resolve this matter
ERROR2:
Required File Permissions to import the templates from Starter Templates are missing.
You can easily update permissions by adding the following code into the wp-config.php file.
define( 'FS_METHOD', 'direct' );
因为我的网站是运行在docker上的,从服务器1迁移到服务器2上后某些文件仍处于没有权限的状态,此时进行如下命令修改文件权限即可:
1、首先关闭docker挂载
使用命令:
docker compose -f <你的.yml文件> down
再更改文件权限
chmod -R 755 /path/to/yourpath/public_html
chmod -R 644 /path/to/yourpathm/public_html/*.php
chown -R /path/to/your/pathpublic_html
然后再重新挂载docker
docker compose -f <.yml文件> up -d
再进入你网站的wp后台(ip:port+/wp-admin)就解决问题了