What to do if “WordPress can’t create an .htdocs file on my Mac”

One of the first things I wanted to do when I first got my MacBook was to install WordPress locally to use it as a development sandbox.

Even after following the tutorial at WP Candy I couldn’t get WordPress to work perfectly on the Mac. I uninstalled MAMP and tried using XAMPP, which I had used successfully on my PC. I had the same problem with both. First, you are not alone. (I was prompted to write this post when an EXPERIENCED developer friend had problems configuring WordPress properly on his brand new MacBook Air.)

After several futile Google searches and digging through the forums (http://wordpress.org/support/) I came up with this solution.

Symptoms

  • WordPress asks for an FTP password when trying to update a plugin. It wouldn’t take my login password, so I reverted to doing a manual update. It worked, but it’s not what we want.
    WordPress asks for FTP credentials
  • If you try to update your permalinks, WordPress chokes while trying tocreate an .htdocs file. It complains about not having permissions to write to the file:
    WordPress can't write to .htdocs file

Solution

Here is how I fixed the problem. I used the terminal to do this (I worked as a Unix Sysadmin for several years). (If there is enough feedback I might do a follow-up on doing it using the GUI an a mouse.)

1. Find the directory where the problem lives:

$ cd /Applications/XAMPP/xamppfiles

 

2. Check the permissions and ownership on the  htdocs folder:

$ ls -l

htdocs directory permissions

3. Find the username that your Mac knows you as. In my case it’s icet. I’ll use myuser for this example. Change the user and group of the folder. One command will do it; you will probably need to use sudo.

$ whoami
$ sudo chown -R myuser:staff htdocs

Change ownership of the htdocs directory

We’re getting closer but Apache still can’t write to the htdocs folder. We need to tell XAMPP to run Apache as someone else

5. Change to the directory where the configuration file lives:

$ cd /Applications/XAMPP/xamppfiles/etc/

6. Make a backup of the configuration file, then change permissions of the configuration file so you can edit it:

$ sudo cp httpd.conf httpd.conf.bak

$ sudo chmod 777 httpd.conf

7. Edit the User and Group lines in the httpd.conf file. I use vim because I’m already at the command line. The Mac’s built-in TextEdit application will work too.

$ sudo vi httpd.conf

7.1. Find the User and Group lines

#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon

7.2 and change them so it looks like this (replace icet with your username from step 3):

#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
# User daemon
# Group daemon
User myuser
Group staff

httpd.conf after the fix

8. Stop and restart XAMPP

That should do it. You have given Apache the ability to write into the WordPress directory. It has worked fine for me for months.

Don’t do this on a production server! It probably introduces several security holes. Find a qualified server expert.

Share

Sure it’s pretty, but will it do what you need?

If you own a business, your website’s first task is to leave a positive impression on visitors. A very, very close second is to explain how you can help.

An interior designer friend wanted a theme that matched her bubbly, quirky, colorful personality. She found one adorned with doodles, fabric, needlework, buttons, and color that met those criteria beautifully. One day she asked me for some help with her blog.

I pulled up her site. “That’s cute. I like how you called your landing page ‘Hmoe.'” I asked.

“What do you mean?” she replied.

“Look. Your first menu item is spelled ‘H-m-o-e.'”

She looked, then cringed. “Where do I go to change that?”

I skipped through the dashboard to find that she had not misspelled something. I started digging into the theme, and I found several problems.

  • Lack of contrast. This had prompted the initial call for help. The page title didn’t stand out, and the byline was lost in the beautiful but busy background.
  • The main navigation menu was hard-coded into the theme, but the user couldn’t edit the links to the landing page. Hello, 404 error! The designer incorporated common page titles into the theme, probably in an effort to make things “easier” for the user. But what if you only have three pages, or name one something different, or blog in Spanish? The theme screamed creativity, then restricted the user blog in a tiny box.
  • The menu elements were also graphics, not text. Without the funky font the original designer used, there was no way I could fix the misspelled word and have it match the other items. As it turned out, I found an updated version of the theme that fixed the typo.
  • The default sidebar widgets had custom graphic headers. Adding user-defined widgets to the sidebar deleted those out. This obviated the need to try to match graphic text, but the new text didn’t fit the rest of the theme.
  • Sharing options were built in to the theme. Again, this was a nice gesture by the designer, but it had limitations. What if your primary market is on a social network not included in the defaults? Without knowing code, the user can’t change this. This is better handled by a plugin.

My friend is now on at least her second replacement theme. Time will tell how long that one lasts.

Share

Dilemma

I am attending WordCamp Chicago 2010That’s right, WordCamp Chicago is less than a month away, and I’m going. I’m excited for it. I haven’t had a road trip in a while, and I’m going to have good geeky company for the drive. I’m looking forward to learning a lot and meeting new people.

That’s all good, but I have a problem with their program. It’s too good! Should I spend more time on the User Track in hopes of picking up a few more tidbits to share with my clients, or should I hammer the developer track to support my personal ambitions of WordPress domination?

Share