It really helps to know how things work when it becomes necessary to fix them.
This was true when I was fixing audio equipment in the early ’70s, and supporting computers and software for IBM, MCI, Interpath, and Cisco over the years, and teaching Linux for Red Hat and my own company, Millennium Technology Consulting LLC. The intimate knowledge of how Linux works has also been invaluable since I started working with it in about 1996.
Unless you know how things really work, there is a tendency to use a shotgun approach to problem solving. That wastes time and, if replacing parts is involved or purchasing new software, can be quite expensive.
After all, would you be willing to pay for the auto mechanic to replace several perfectly good parts while trying to find the one part actually causing the problem – and to pay him for time and materials as well? Of course not. Although that used to be the case more often than it should have been.
I submit for your approval a problem I just fixed this morning – with this web site.
It was not a problem that affected the external operation of the DataBook web site, but I could no longer use any editor from within WordPress to edit pages and posts such as this one.
Because I know several important things about WordPress I was able to think about the problem and correct it on the first try. I know the following about WordPress:
- The data for WordPress web sites is stored separately in a MySQL database. Separation of data and code is always a good thing to do.
- There is one and only one, small site configuration file for each WordPress web site, wp-config.php.
- All WordPress plugins, themes, and uploaded graphics also have their own directories.
- The Apache web configuration is separate from the WordPress site configuration.
So it was a simple matter to simply delete the entire directory in which the WordPress instance was installed for that web site. Everything.
I then copied the entire directory structure from a known working web site to replace the one I deleted. I then copied the original wp-config.php to the appropriate location in the newly copied WordPress directory structure and my web site was up and running again. It was then trivial to copy from backups the rest of the plugins and graphics to complete the process. All in all it took less than 5 minutes.
Not having the understanding I do of how WordPress, MySQL and Apache work together to produce a web site, I would have been tempted to simply delete everything in the WordPress directory (/var/www) for that web site and start over by reinstalling WordPress and configuring it from scratch. As easy as that is for WordPress, it would still have taken much longer than it did for me to actually fix the problem.
If I had understood more about the PHP coding of WordPress itself, I probably could have simply repaired the offending file that was likely corrupted for some reason. But that would probably taken much longer in any event.
If you are interested in learning how Linux works so that you can identify, understand and fix problems in the most effective ways, try the Linux classes I offer at Millennium Technology Consulting LLC.