Alan Wylie's Web Site

Wed, 2020-12-30


Apache, PHP and "EROFS" permalink
Trying to install Nextcloud, I had failures with PHP not being able to write into the config directory.

"message":"Cannot write into \\"config\\" directory! This can usually be fixed by giving the webserver write access to the config directory.. Or, if you prefer to keep config.php file read only, set the option \\"config_is_read_only\\" to true in it

access("/usr/share/webapps/nextcloud/20.0.4/htdocs/config/config.php", W_OK) = -1 EROFS (Read-only file system)

I finally tracked down the meaning of the "EROFS" error - it was because I had this systemd config for the apache2 service:

ProtectSystem=full

See "man systemd.exec":

If true, mounts the /usr directory ... read-only for processes invoked by this unit

I solved it by setting "config_is_read_only" as suggested, but also needed to make sure that the "data" directory was under "/var/www". I also had to set "'writable' => false," in the "apps_paths" setting of "config.php".