Discovering Laragon for Local WP Development

Run WordPress on a Laptop?

Impatient? Click here for the TL;DR.

Have you ever thought it might be fun to experiment freely with WordPress? I mean without the fear of wrecking your existing site, fumbling with server settings, or paying for hosting you aren’t sure you even want?

When I discovered WordPress years ago, a friend hosted my first site. After a while I bought web hosting, and eventually started helping others with WordPress. Later I found XAMPP, and it served me well for several computers (even through the MacBook Pro experiment).

XAMPP was a great tool. It gave me a bigger sandbox, some new toys, and a sense of freedom. It simplified the development and theme-editing process. It also required a fair amount of work to set up a new instance of WP.

Enter Laragon

Recently I needed to set up a development environment on a new laptop. A search for “Windows alternatives to XAMPP” turned up Laragon.

In under 40 minutes, I had downloaded and installed Laragon. Then I found the unadvertised “Quick App” tool that installed WordPress. It worked quickly and flawlessly. I didn’t have to create a new database and user. I didn’t have to remove any big-brother bloatware that many one-click installs force upon their unwitting users.

As icing on the cake, I can type a “real-looking” domain name in my browser (I’m writing this at simple.test). In theory, XAMPP can do that too, but I never managed to wrangle the arcane configuration files to confirm that.

Let’s Do This!

Are you ready to try it? Here are the basic steps to set up your own local hosting environment.

You will need a Windows PC (desktop or laptop). I’m running Windows 10, but it will probably work on Win7 or Windows 8 (did anybody ever use that?).

Download Laragon

There are three options on the Download page. I used the Full version, but the Lite version would have worked fine. If you have older hardware you might want the Portable version. The link directed me to SourceForge to start download. Save the file to your hard drive.

Install it.

  • Find the file you downloaded and run it.
  • Click “Next” to accept the installation directory.
  • I disabled the Auto-start because I won’t use Laragon all the time. Leave it checked if you expect to use it often.
  • Click Next, then click “Install” and wait a few minutes.
  • At one point I had to click a Windows security box to allow the “Auto virtual hosts” feature.
  • When the wizard completes, click Finish to start Laragon.
  • Click the “Start All” button.

That’s pretty much it.

Quick Tour and Interface

  • The Menu is grayed out. It took a few moments before I realized I could click it.
  • Menu/Laragon/Web will launch a browser and load the Laragon splash page.
  • Menu/Laragon/Database launches a browser tab with PHPMyAdmin. The default user is root, empty password. (I had to Google it.)
  • Menu/Laragon/Terminal is for the hard-core Linux user. This will probably allow power users to play with the WP-CLI.
  • Clicking X in the Laragon window minimizes it to the system tray.

Installing WordPress

Enough already. Let’s get WordPress running.

  • Menu/Quick App/WordPress

    prompts for a project name…

    then runs through a few items on the back end. Windows will notify you that it created a new database and project with a pretty URL.
  • Click Visit site to finish start the WordPress installation.
  • Choose your language and continue.
  • Remember to copy your password! I’m serious. I did not, and I spent more time figuring out how to get the password reset link (more about that in the gotchas) than I did installing WordPress.
    11. WP Install - Save your Password!
  • After a few more clicks you’re ready to go!
    12. Success - WP Installed

Welcome to your Dashboard!

Welcome to your WordPress Dashboard!

With a fresh WordPress install, it took a little while to load the site the first time. After that it was pretty snappy. Even the block editor didn’t totally suck.

This is your WP installation. You have complete control. You can install any plugins or themes you like. Experiment. Learn CSS, PHP or JavaScript. Back it up. Break it. Restore it. Build your skills and your confidence.

Gotchas

Interface
The Menu is grayed out. It took me a while to realize that I could click it.

Email
Email doesn’t work out of the box.

via GIPHY

The mail configuration wants to use a gmail account. Google handily blocked this (and sent me a few notifications of an access attempt). I haven’t needed this feature it yet, so I have not gone farther to debug.

Email Catcher
Leave this enabled. It will let you to see the contents of the emails that Laragon couldn’t send. I needed this to reset my password. Twice.

The Mail Catcher lets you see what the system tried to send (and couldn’t).

Add-ons and Upgrades
I tried adding the latest version of PHP (I think it was 7.4 when I first installed Laragon) and Apache wouldn’t run. I switched back to PHP 7.2.19 and everything worked fine again.

Conclusion

Laragon is not perfect, but it’s pretty darn awesome.

While I did not test all the advanced features (like the ability to swap from Apache to NginX or downgrade to an older PHP version), the process appears simple.

The “grayed-out” menu was weird for a bit (I’m not sure why I’m still hung up on that). The email glitch is annoying, but not a show-stopper for me.

The ease of installing Laragon and a simple interface are great. Installing WordPress was a joy. Seriously, it took me many times longer to write this post than it did to install Laragon and create a new WordPress site on my laptop.

I happily give Laragon 4.5 stars out of 5.
4.5 Stars out of 5
(Image credit )

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.

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.

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?