Local XAMPP development and UNIX file permissions

If you are using XAMPP Apache+MySQL+PHP stack to develop web applications on your OSX or Linux computer you might want to fiddle with Apache settings to make your life easier.

By default XAMPP users nobody user for running Apache. If you try to load any file created by your normal system user Apache will give access denied error. This means that either you must make all PHP files readable for everyone, or change the file owner. This is painful if you need to repeat the process for every file.

Instead, it is easier to make XAMPP run under the permissions of your local user.

Edit /Applications/XAMPP/etc/httpd.conf:

<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>
User yourusername
Group staff
</IfModule>
</IfModule>
<IfModule !mpm_winnt_module><IfModule !mpm_netware_module>
DocumentRoot "/Users/yourusername/yoursiteroot"

You also need to change the location of setting default folder execution rights htdocs location to your development location

#
# This has been changed from /Applications/XAMPP/htdocs
#
<Directory "/Users/moo/code/joomla/mobilejoomla_dev">
    Options Indexes FollowSymLinks ExecCGI Includes
   AllowOverride All
</Directory>

And now Apache will happily eat all files you create or edit.

\"\" Subscribe to RSS feed Follow me on Twitter Follow me on Facebook Follow me Google+

11 thoughts on “Local XAMPP development and UNIX file permissions

  1. Pingback: XAMPP und Zugriffsrechte unter Mac « .crashsource

  2. Much better than trying to change owner to “nobody”, will try it out tomorrow. Might delay my delusions of being Odysseus for a while.

  3. Awesome!

    I’ve been looking for this information (EXACTLY), since yesterday, and you wouldn’t believe how hard it was to find a good answer…

  4. Thanks a ton. This saves my countless seconds having to change permission on every new project!

  5. Pingback: [osCmax V2.0.25] Localhost: problems with admin - images directory permissions and more...

  6. Hello,
    I have some problems with uploading images in WordPress (is wp-content/uploads writable). I was adviced to follow the steps above. However, my htppd.conf can’t be overwritten (only published). Any solution to this? And, is this the solution to be possible to upload images on my (local) WordPress site?

    Looking forward to hearing from you.

    Regards,

    Iris

  7. Hi,

    Can you be more specific about what you mean with this:

    However, my htppd.conf can’t be overwritten (only published). Any solution to this?

  8. To be specific: I can’t make any changes in the this file
    Edit /Applications/XAMPP/etc/httpd.conf:
    I can only ‘read’ it

    rgds

Leave a Reply

Your email address will not be published. Required fields are marked *