First things first, I say this in many of my articles, but in this one you can take it as fact. I am not in any way an expert when it comes to WordPress. I am strictly a user. I don't know the programming languages involved, and although I could probably glean what is going on from the code, I have never done so.
For many years I did work as a website developer. I did a lot of coding (pre-CSS) in HTML (that is kind of like saying you write programs in DOS -- it means next to nothing, except possibly that you have just dated yourself). Because of this I do have a little bit of a handle on how things work, but obviously not enough. I will admit up front that I did what I tell everyone I work with not to do, under any circumstances, change things directly in your production environment - but I will get back to that.
For a couple of months my blog was down. I take complete responsibility. I was adding plugins
, everything was working fine until I logged
out and couldn't log back in. I think it had something to do with the functions.php file I edited (I never should have done that, but I am a great Monday morning quarterback ...). During a plugin install, it was suggested that I add a line to this file. Everything seemed to be working fine after the edits so I logged out (I have a feeling that I edited the wrong functions.php file, there are so many ...).
I am a computer analyst as my day job and specialize in computer security
. I get the daily updates about security threats, so I can keep informed and keep my department up to date. One of these updates mentioned a security problem with the then current WordPress
install and I figured I would keep my WP install up to date. When I tried to log in to update WordPress, I was unable to -- I received the two errors below. It seemed like everything was hosed. Although it turned out it was an easy fix, I didn't figure that out for almost 2 months.
Finally, I decided to try to fix it myself. At first I thought I would just upload some backups. Then I found that I was unable to connect via FTP
. It turned out that the hosting company had changed the FTP authentication method (that is how long it had been since I last used FTP to access the site).
Once I changed the way I tried to connect I was able to easily connect (using FileZilla). I looked at several configuration files. None of the ones I tried did any good. I tried deleting several of the newest plugin directories. Although this just generated more errors
when I tried to log in, I think it also may have gotten rid of the main stumbling block to the log in process itself
. Now I needed a WP expert to help me out, because I didn't know which configuration file to edit. I was toold to try the wp-config file
and to change the Debug
variable from false to true.
I downloaded the file and then edited it and replaced it. This worked. I was able to get into my site (probably due to the deletion of the plugin directory that was causing the problem to begin with). When I logged in, there were a slew of errors, there were also a bunch of updates. I sent the errors to my son, the WP expert referenced above.
Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home1/chronoto/public_html/tom/wp-includes/functions.php on line 3508
Notice: Undefined index: pluginVer in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 68
Notice: Undefined index: marginHeader in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 600
Notice: Undefined index: marginTop in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 602
Notice: Undefined index: marginLeft in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 604
Notice: Undefined index: marginRight in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 606
Notice: Undefined index: marginFooter in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 608
Notice: Undefined index: footerMinHeight in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 610
Notice: Undefined index: footerWidth in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 612
Notice: Undefined index: footerX in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 614
Notice: Undefined index: footerY in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 616
Notice: Undefined index: footerFill in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 618
Notice: Undefined index: footerPad in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 620
Notice: Undefined index: pageSize in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 622
Notice: Undefined index: unitMeasure in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 624
Notice: Undefined index: orientation in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 626
Notice: Undefined index: liSymbolType in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 628
Notice: Undefined index: liSymbolWidth in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 630
Notice: Undefined index: liSymbolHeight in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 632
Notice: Undefined index: pluginVer in /home1/chronoto/public_html/tom/wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line 634
Apparently, this particular PDF plugin is quite popular and poorly written -- at least that is what two WordPress experts have told me and what is evident when WP_Debug is set to true.
I first updated everything. After WordPress and all the plugins were updated, almost all the errors were gone. I continued receiving errors from the PDF plugin until I changed the Debug variable in the WP-config file back to false.
What is the take away?
- First, don't haphazardly edit php files (especially if you are like me and don't understand much about PHP)
- I will be very careful next time I try this (which I hope will be never)
- Second, Backup, Backup, Backup ...
- I used to use the free UpdraftPlus plugin to backup to my dropbox
- I have been looking around for a more comprehensive backup tool. One WP expert suggested Backup Buddy (paid) and said about it, "the best backup tool IMO." I looked at the following:
- Backup buddy - paid, but highly recommended
- ManageWP - trialware - Good if you manage more tha a couple of WP sites
- Beware this plugin leaves a backup directory when it is uninstalled
- Duplicator - WP plugin, so free
- WP BackitUp - WP plugin, so free
- Beware this plugin leaves a backup directory when it is uninstalled
- backups are good, in the extreme, but remember that a backup is useless if you are unable to restore using it.
- so far as I can tell, the backups generated by the UpdraftPlus plugin do NOT create a clone of the site
- Third, use the wp_config debug variable - it can be a real time saver, but don't forget to change it back to false or your error.log file will grow exponentially if there are any errors in your plugins (many will throw some errors).
- If you have difficulty, address it immediately (don't wait like I did)
- Problems with WordPress may often be solved with updates to the core or plugins
- Use as few plugins as possible
- Because there is less chance of hosing your site from bad code
- the more plugins you use the slower your site will be
- Get rid of old themes you are no longer using, or have never used
- Themes take up more room than you think, so deleting old ones will give you more space to play with
- the older the theme, the more likely it will have problems with newer versions of WordPress.
- Use a staging site for changes - I will explain this one further
With points #6 and #7 in mind, I logged into my site and have started deleting any plugin I don't use regularly. I deleted the PDF plugin. It needs to be replaced, because I like the function it performs, a button to download a post as a PDF file. And I had around 10 themes installed. I had only ever used 3 of them, and only like the one I currently use (customizr) and one other. By getting rid of the rest of them I freed up a lot of space.
(point #2 above)
I have tried several backup options and can say, withouta doubt, that Backup Buddy was the easiest and most comprehensive tool.
What is a staging site, how do I set it up, and how do I use it?
- I downloaded the zip plugin from their homepage
- In my WordPress site, I went to add new plugin and clicked the upload button
- pointed the dialog to the zip file
- the plugin was installed and I activated it
- I linked my dropbox
- I asked it to make a backup and download it to my dropbox (note that in this case, size does matter. The first time I ran this backup it stalled when it reached a whopping 7.15gb. It turned out that several other backup plugins had left a lot of garbage in several different directories, specifically UpdraftPlus and ManageWP. By deleting these extra backup zip files I regained over 6gb worth of space. The last backup I made of my entire site was just over 500mb.)
- to clone or move your site, simply download the importbuddy script and the backup zip file you just created to where you are going to install the site (http://yoursite.com/)
- Run the installbuddy.php script (http://yoursite.com/installbuddy.php) BEFORE installing WordPress, and you are done.
These are questions that would be better addressed by a WordPress pro/expert. The answers also comprise a whole other article. I will try to summarize here. First, I should make it clear that if I had been doing this to begin with, I wouldn't have had this problem, because I would have discovered the problem locally before publishing it to my production site. As a computer analyst, specializing in security, I continually am reminding people to backup their computers and devices. I also always recommend that people NEVER make initial changes on a computer they are using for work -- their "production" machine -- but rather to make any changes in a test environment, preferably in a virtual machine. In this way if there is a problem one only needs to delete the VM file and/or go back to the last save in order to recover from what could have been a disaster. I used to do this with websites I was developing as well, but somehow got away from that. Before my institution started requiring us to use Ektron 400 CMS, I used Dreamweaver, which would keep a copy of the site locally and sync to the remote server. This was an extremely easy way to develop websites without the danger of putting in code that didn't work and could take down the whole site.
So how do you do that for a WordPress site? The short answer is, that depends (sorry). What does it depend on, you might ask. Several things, but the most important is what is running in the backend. Are you going to run Dreamweaver, or something else? What local server is running and what protocol are you going to use? We'll take this one step at a time (just remember, you need to measure the time this takes to setup against the time you will save if your site goes down, not to mention the peace of mind you will gain).
I decided to test this out myself to see what it was like to setup a local WordPress instance. I wanted to be able to edit the local site using Dreamweaver, mostly because that is what I have always used to create and edit websites. After only a little searching, I found this video
on setting up a local instance of WordPress with Dreamweaver. It turns out that DW will not properly display PHP code (at least my older version -- CS3). So you should take that into account when trying this out. There are several steps to the install, all of which are covered in the video referenced above. To summarize, they are:
- Download and install WordPress
- Download and install a server, such as MAMP, WAMP or XAMPP (the last seems to me to be the hardest to setup, but that is my personal opinion)
- Configure your WordPress installation with your server install
- Export your WP file(s) from your online account to a local file
- Import the local WordPress file(s) you just downloaded
After doing these steps, I found that the sites did not match. One still has tweak the local site, because the configuration is not correct (I found that all the work I had put into customizing my WP site to get it to look the way I wanted was for naught, because the local site looked like a plain vanilla site). And you should be aware that many of the customizations you make online are not exported when you use the normal export everything in WP. The best discussion/resolution I have found about this is in this thread
. Also note that this post
seems pretty comprehensive (using MAMP to create a local duplicate of your site). I used some of his steps, and they worked well. I think though that I may have mixed too many different approaches in my attempt to get an exact look alike site on my local machine.
I did get it to work pretty well using MAMP and BackupBuddy. Here is a silent video
of the steps I took during installation and restore. The only hard part (the rest is easy) is setting up the local database on your computer. I ended up using phpmyadmin in MAMP for that and it was fairly straight forward.
This homepage for MAMP comes up when you have correctly installed it.
This phpMyAdmin age is brought up from the tools -> phpMyAdmin menu item
See the discussion above regarding Backup Buddy for more information about creating a local site. I found that solution the easiest.
For further information check out this question
on DW and WordPress (the answer is partially -- don't use DW). It eventually came down to, since my version of DW didn't or couldn't display PHP properly, I am looking at other options. You can also check out this question
(note the answer). You can access Expert Exchange's list of WordPress video microtutorials here
Related outside articles