Fixing apache file permissions on Mac (El Capitan)

I’ve been using my local development environment with apache, php, mysql and always had some issues with file permissions, but never gave it enough attention to fix it as I was always doing something else. Tired of this, wanting to do some backups with WordPress, plugins, etc I’ve found the following commands that fixed my machine, hope this can help you.

Here we go:

Open httpd.conf:

        
        
          
            
          
          
            
          
        

        sudo vim /etc/apache2/httpd.conf

      

Go and find the following line:

        
        
          
            
          
          
            
          
        

        User _www
Group _www

      

Now change it to:

        
        
          
            
          
          
            
          
        

        User your-username
Group staff

      

Restart apache:

        
        
          
            
          
          
            
          
        

        sudo apachectl restart

      

You can also update your folder ownership with the

        
        
          
            
          
          
            
          
        

        chown -R your-username:staff foldername

      

Remember to replace your-username with your real username in my case is miguel. My parents did a great job with my name, aye!

Have a nice day.

Further reading