Hello,
You only need to set rw access to the .config folder of the home folder. For example if you are using /var/www as home folder, you need to set rw access to the user that runs the web server to /var/www/.config.
About your command, you don't need to change phpdocx, you can set a custom home folder using the putenv function. For example to set it to /tmp:
putenv("HOME=/tmp");
Regards.