Mac OS permission problem after installing PHP / Apache / MySql

Posted on 2009-04-29
Last Modified: 2013-12-13
I'm trying to setup a an Apache / MySql / PHP environment to develop dynamic websites. I've installed, and enabled and got working all of the components, edited and amended the httpd.conf and php.ini files as directed in both written material and following a tutorial.

This is my first attempt at doing this on a Mac. I've done this without problem on a Windows PC using Wamp but trying to get this working on my MacPro desktop.

The problem is when I open a browser to view a file in my local user sites folder, i.e. test.php that  I get a permissions error.

You don't have permission to access /~Richard/test.php on this server.


The url I try to goto is http://localhost/~Richard/test.php and this results in this 403 error.

Being a Mac newbie could someone please guide me as what I need to do to provide the right permissions on which folders and how best to set them to get this up and running.  Thanks.

Question by:richard1966
    LVL 4

    Expert Comment

    You essentially just need to have read permissions to the world. So you need 755 for directories and 644 for files. You can do this using the chmod command line tool. (i.e. chmod 755 directory or chmod 644 filename).
    LVL 4

    Expert Comment

    Also, note that if you are trying to change the permissions of a file or directory that is not currently owned by your user (i.e. a system folder or file) then you may need to add a "sudo" to the beginning of the commands I listed above.
    LVL 4

    Accepted Solution

    LVL 4

    Assisted Solution

    You might want to note that the above link is written for the apache that comes with Mac OS X. If you installed your own version of apache then you might not have a users directory in your etc/apache folder. If you not then you can simply add the information in step 3 directory to your httpd.conf file. Also note for all this to work the way you want it you will have to have the userdir_module loaded in apache.

    Author Closing Comment

    Thank you both for this - The Apple Support article nailed it straight away and the advise from my2eggs although not used to sort this was very good as well so thank you to you both.

    Despite Mac been a a little more quirky to set up, it is so much better than a PC and that comes from someone who is a recent convert.

    Thanks again!

    Author Comment

    Asking the right question is key to getting an answer - what I should have stated in this question is the following - Web Sharing - "Forbidden 403" message appears instead of website content - thanks to the experts on here they were able to figure out what I needed to know.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    This is a short article about OS X KeRanger, and what people can do to get rid of it.
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now