Manually disabling WordPress plugins

If you’re adding new plugins to your WordPress site, depending on the plugin type you can end up with your site being inaccessible if the plugin configuration is wrong. A good example is adding Google’s reCAPTCHA plugin. If you activate the plugin but the config is not correct, for example if your site id is not matching your domain name, AND if you’ve added the reCAPTCHA on your login form, you can end up in a position where you’re completely unable to log on to your site.

Luckily if you can ssh into your server, you can disable a plugin easily by just removing or renaming the plugin folder, for example in your wp-content/plugins folder.

More info in this article.

Increasing media upload size for WordPress / PHP5

On a default WordPress 4.8 install on PHP5 the default file upload size seems to be (at least on my install) 2MB. If you’re uploading large image files or videos, it’s likely you’ll want to upload files much larger than this.

There’s a number of possible configuration locations that can control/configure the upload size. The first location is likely to be your php.ini file used by your apache or nginx. The settings to increase are:

  • post_max_size (must be larger than upload_max_size)
  • upload_max_filesize
  • memory_limit

This article has a comprehensive walkthrough the possible configuration changes.

Comparing nginx memory usage to apache2

I’ve trimmed down my apache conf to work ok for a small site, but after uploading my exported data from my old site to my new, the 4x apache2 processes have grown considerably and consumed all my VPS memory. Knowing nginx has a much lighter footprint, I wondered what it would look like in comparison.

Here’s the memory usage after completing my exported data file imports – I get that after completing this imports to the new site this is the memory usage of the apache processes after load from importing about 20x 10MB xml export files. At idle after a restart the memory usage does start considerably lower, but here’s where I’m at right now:

$ ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r
%MEM %CPU   RSS    VSZ COMMAND
32.2  1.7 169228 904300 /usr/sbin/mysqld
24.5  1.2 128684 385360 /usr/sbin/apache2 -k start
20.2  0.2 105968 355004 /usr/sbin/apache2 -k start
18.4  4.0 96740 352540 /usr/sbin/apache2 -k start
 2.5  0.0 13144 283312 /usr/sbin/apache2 -k start

So following the guide here just to install nginx and the fastcgi php, and then here for WordPress specific config, here’s what it looked like on restart:

$ ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r
%MEM %CPU   RSS    VSZ COMMAND
 9.3  0.4 49124 576488 /usr/sbin/mysqld
 6.0  0.0 31516 235504 php-fpm: pool www                                                       
 4.5  0.0 23860 232660 php-fpm: pool www                                                       
 2.6  0.0 14032 230016 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)                    
 0.5  0.0  2804  86472 nginx: worker process
 0.3  0.0  2004  86128 nginx: worker process
 0.3  0.0  2004  86128 nginx: worker process
 0.3  0.0  1988  86128 nginx: worker process
 0.3  0.0  1900  33188 init
 0.2  0.0  1452  85832 nginx: master process /usr/sbin/nginx

This is looking better, still need to work on getting the mysql usage down, but at least now I’m not maxed out:

$ free
             total       used       free     shared    buffers     cached
Mem:        524288     431192      93096      68180          0     259440
-/+ buffers/cache:     171752     352536
Swap:            0          0          0