解决php的readonly filesystem问题

原因

php-fpmsystemd服务默认开启了ProtectSystem=full选项,使得网站根目录所在的/usrphp-fpm只读

解决方法

假设网站根目录为/usr/share/nginx/html/

sudo systemctl edit php-fpm.service

添加

[Service]
ReadWritePaths=/usr/share/nginx/html/

重启服务

sudo systemctl restart php-fpm.service

即可