One Thing Leads To Another

You know the reason why there is so much time in between my posts? I’m busy struggling with my latest tutorial or project. I doubt that I have to tell any of you that nothing works the way the instructions say they will. As a wise and very funny woman once said, “It just goes to show you. It’s always something”. What an accurate description of web development and of course, life. And if you don’t know who that woman is, ask your parents. This is going to be a more detailed post, so get a beverage and settle in for a few minutes.

I’m getting closer to actually selling something on the web which means picking a Content Management System. Do I use Shopify, WordPress, Facebook, Joomla! etc? Or build a stand alone site and use a crowdfunding site? I thought I would give WordPress another look since it is so very popular and it would be to my advantage to understand it through and through. But I don’t want to have to develop my site online. This meant that I needed to set up a localhost.

Localhost refers to the local computer that you are running your program on. You can view your site in your web browser but it doesn’t go out on the web, or WAN, it all remains on your computer. The localhost has the IP address of, this is called a “loopback” address because whatever information is sent to it is routed back to the local machine. This is great for template and theme designers. I really didn’t think this was going to be such a big deal because I did my entire PHP course locally, about a year ago. But no, it wasn’t as easy to setup as I thought. I know, when will I learn?

This is not an instruction on how to set up XAMPP on your Windows computer, there are plenty of sites for that, but this is a “diary” of the problems I encountered. Maybe reading this will help you one day. If anyone is even reading this. By the way, if you are reading this just leave a comment to at least say, “Hi”. It would mean a lot to my self-esteem. Better yet! Follow my blog! Maybe one day I’ll bother to SEO this blog. So distracted today, where was I, oh yes.

Let me first start with a little rant about port 80. If other software is using port 80 then it interferes with localhost, which defaults to port 80. Just so you will all know, apparently Skype defaults to port 80 as well and will always, always conflict. So you either have to change the port number for your localhost or for Skype. Or, make sure you don’t have Skype running while using your localhost. This one problem has caused many, many people to seek out a solution and they don’t always use nice language like your lovely designated driver. Ahem. Seriously, you would not believe how many forums and support pages are full of desperate people seeking help over this. I’m not a programmer or expert, but who the heck decided to use a port that they know is going to interfere with the localhost listening port? Was it REALLY necessary? Sheesh. Anyway, even though I refuse to put Skype on my computer, I still had to change my port to 8080.

  • At the XAMPP control panel, Apache “Config” button – choose “httpd.conf”.
  • Scrolled down to line 58 and change “Listen 80” to “Listen 8080”.
  • Scroll down to line 219 and change it to “ServerName localhost:8080”.

Save and close. The main problem is that I can’t just have the default localhost/ in the address bar, I have to type localhost:8080/ every time. Bah!

Let me back the car up and get back on track. Since it had been maybe a year since I had last used XAMPP, I decided that it would be a good idea to download the latest version. XAMPP is a PHP development environment and can be downloaded here or here. To quote,

“XAMPP is a completely free, easy to install Apache distribution containing MySQL, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use.”

Hahahahaha…sorry, that made me laugh. Actually, it would be easy to setup if it weren’t for the port conflicts and the somewhat vague directions in setting up parts of myphpadmin regarding user and password and the editing of certain config files.

One of the first instructions I was given from a professor online was to remove all anti-virus software and to set Skype and VMWare not to run at startup. I’m not saying this is the gospel truth but he swears that if you have Win 8 or 8.1, all you need is the built-in Windows Firewall and Windows Defender. Use the Task Manager’s Services tab, (Ctl+Alt+Del) to find out which services are automatically starting when you computer boots up. There you can disable any that are causing problems. Then restart the computer. You aren’t disabling the programs, just disabling them from automatically starting when you turn on your computer. If you still continue to get an error that a service is still currently running or open in another place, quit XAMPP, go to your Task Manager and if the programs that you quit appear in the list of services running, quit them. Then start XAMPP again.

I must stop here and say that I had to do this many times. Often I would make a change to my settings in the XAMPP config file and need to stop and restart the services for the changes to take effect. Sometimes I got an error on restarting the service so I would quit the control panel, open the Task Manager and I would find XAMPP was not only listed as running, but it was listed twice. Once msqld was listed as well. Quit the programs that were not suppose to be there because you closed them and reopen XAMPP, and carry on. It makes no sense, this is a wild guess but maybe it’s a caching problem?

I wanted to be able to work on WordPress files in this environment because WordPress uses PHP. After I had XAMPP, which is Apache, MySQL, PHP and Perl installed, I downloaded the latest version of WordPress, extracted its contents and copied it all into the htdocs folder in the XAMPP directory. While setting up XAMPP I had to give MySQL a Password, but I left the user as the default “root”. For XAMPP Directory Protection (ht.acess) I set up a Username and a Password. Clicking on the Admin button next to Apache in the control panel, I accessed via my browser, the XAMPP page that had many menu choices. Toward the bottom under Tools I clicked on phpMyAdmin. This is where it got sticky, but eventually I gave the correct password to get in. It was only sticky because I had done the steps several times and got confused. This is why you should have a dedicated notebook by you. I write down the steps and passwords as I go. Oh yes, also in the XAMPP control panel, for MySQL there is also a Config button. I opened the my.ini file and filled in the password. See below. I found that this solved “one” of my problems.

  • # The following options will be passed to all MySQL clients
  • [client]
  • password = mypassword (that I set up initially MySQL )
  • port = 3306
  • socket = “C:/xampp/mysql/mysql.sock”

Before you can open and use WordPress, it needs an empty database to use for it’s information and tables. Opening mySQLadmin, I created a new database, “wpdb01”. Just a database with a name, no tables. Then created a new user “root” and gave that user full privileges to the database of wpdb01 and a password. But it doesn’t stop there. Next, I went to the WordPress directory which is, C: /xampp/htdocs/wordpress/ and opened the “wp-config.php” file in my editor, Notepad ++. Filled in the following:

/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wpdb01‘);

/** MySQL database username */
define(‘DB_USER’, ‘root‘); (user I created in DB)

/** MySQL database password */
define(‘DB_PASSWORD’, ‘password‘); (that I gave DB_USER)

/** MySQL hostname */
define(‘DB_HOST’, ‘‘); (for some reason the actual IP address works better than “localhost”)

Save file and close. This step is crucial to WordPress recognizing the database so it can populate it. If all goes well, then you may type in your browser’s address bar “localhost:8080/wordpress” and you should be ready to rock and roll. As I mentioned I had to change my listening port from 80 to 8080 for localhost to work. Your experience may vary.

In the interest of full disclosure, after starting all over several times, I gave up. Not completely. I tried WAMP and although I miraculously had no port 80 problems, I still couldn’t get WordPress up and running. So, I was more determined than ever to force XAMPP to work. After more resetting names and passwords and databases and stopping the software and starting it again, plus doing the Task Manager shuffle…I got it to work. I felt like I deserved a medal! I was so tired because this was a four day ordeal. I kid you not, maybe I’m just that thick. But hey, I’m learning all of this stuff on my own. I don’t have a mentor or even a friend that I can ask about this stuff.

While I was searching for answers online I came across a tuts+ article that I bookmarked for later. Now that my localhost problem was solved. I thought I’d look at the tutorial, “The Command Line for Web Design”. I have to say that I learned a lot and was impressed at the speed of installing software on the command line. And then, I was told to look in my “build” folder and I would find my new CSS file. It was empty. So somewhere I didn’t do something right and I think I know where to start looking. If you are crazy curious about learning as I am, I added a link on the sidebar for you to check it out. If all goes well, maybe I’ll tell you about it at my next road stop.

This morning I innocently went to my localhost:8080/wordpress and received a “cannot find database” error. What? It worked just a few days ago. NOW it doesn’t? I spent most of today fixing that, again. This road trip down web dev lane is not for the weak of spirit. I think it’s time for a well deserved snack. Have fun learning everyone and wear your safety belt. And your thinking cap covered in tin foil.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s