How to write to Apache DocumentRoot?

The httpd service is running as the wwwrun user and you’re telling it to write into a directory owned by another user (like tmciver). You could grant the httpd service access to a directory outside of your home that wwwrun uses, or if this is a dev box without outside (incoming) access you could run the httpd server as your own user by setting services.httpd.user = "tmciver"; and services.httpd.group = "tmciver";.

While the two solutions above hopefully answer your question rather directly I’ll point out that there are much better approaches out there for what you are looking to do. Actually just earlier today @domenkozar posted on another thread about an awesome development environment for php developers. I would strongly encourage you to abandon your current approach and take advantage of https://devenv.sh/. From this point on I will be suggesting all php developers I know to use this. I say this as someone who has done extensive devops work for a php shop.

Some big advantages to using https://devenv.sh/ in your position:

  • abandons httpd in favour of caddy, which is much better suited for a local environment
  • abandons mod_php in favour of php-fpm, which is much better suited in any non legacy environment
  • batteries included approach covers pretty much everything you will need when developing with php

Really - consider it :+1:

2 Likes