• Hello all!

    MacOS Sierra 10.12.6, Server version: Apache/2.4.27 (Unix), mysql-5.7.16-osx10.11-x86_64

    I tried to install WordPress under 1. /Library/WebServer/Documents/name_of_new_site/ and 2. ~/Sites/name_of_new_site/

    Ad 1.
    Everything works fine, except issues with permissions, when I add pictures. The permissions are:
    /Library root wheel
    /Library/WebServer root wheel
    /Library/WebServer/Documents root wheel
    /Library/WebServer/Documents/name_of_new_site my_user_name staff

    Ad 2.
    Nothing works! WordPress changes the localhost/~my_user_name/ to localhost/

    Any help?

    Best greetings
    marek

Viewing 6 replies - 1 through 6 (of 6 total)
  • coolestguidesontheplanet.com is great resource for localhost troubleshooting on macOS:

    highly recommend reviewing the tutorials (and some others on there) for pointers on getting /~username/ to work.

    note: When I upgraded to High Sierra, my apache configs reset and got weird, so if you were planning on upgrading to 10.13 its better to do that first, imho.

    • This reply was modified 7 years, 3 months ago by David Sword. Reason: cleaned
    Thread Starter marek_step

    (@marek_step)

    Hello David!

    Thank for your answer. I found the culprit. Pretty easy if you know!

    Open your Terminal and change the owner of your your folder /wp-content/uploads/ like follows:

    sudo chown -R _www /Library/WebServer/Documents/your_new_wordpress_site/wp-content/uploads

    or in your ~/Sites it would be:

    sudo chown -R _www /Users/your_user_name/Sites/your_new_wordpress_site/wp-content/uploads

    For Unix it would be an other owner: www-data

    Hope this helps some others. Needed two hours to find it (blushing!)

    marek

    Dion

    (@diondesigns)

    While that will work temporarily, it’s not a good solution since more files will be added in the future.

    If file ownership is the problem, and Apache was installed with mpm_prefork and mod_php, then the best solution is to change the Apache confiuration to run as the localhost user and not as “www-data” or “nobody” user.

    In your case, you would need to revert the file owndership to its original state before making this change.

    Apache should run as www

    Dion

    (@diondesigns)

    Theoretically that’s true, but:

    • We’re talking about a *nix-based localhost install
    • We must deal with obsolete garbage (mpm_prefork and mod_php)

    The best *nix-based Apache/PHP production setup would be PHP-FPM, and Apache configured with mpm_event. That would allow Apache to run as “nobody” and PHP to run as the user that owns the web-facing files. But on localhost installs, as long as Apache is configured to only listen to 127.0.0.1, whatever gets the job done is best. ??

    I follow this tut on ALL my Macs and have them all set up to run WP in a root level WWW folder and each WP install is reached @ https://folderName.dev

    https://mallinson.ca/osx-web-development/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WordPress localhost & localhost/~user_name’ is closed to new replies.