Search form

PHP

WordPress: Optimizing Nginx and WP Super Cache

Today we're going to compare the performance of a WordPress site before and after we install and optimize the WP Super Cache plugin.

We're running Ubuntu 16.04 Server, Nginx 1.10, PHP 7 with the Zend OPcache, MariaDB, and WordPress 4.6 with a few other plugins (Akismet, Jetpack, Yoast SEO, and Google Analytics). The system itself is a humble virtual server with 1 "core", 2 GB RAM, and SSD storage, costing $10/month.

Ubuntu 16.04 Web Server with Apache, PHP, and MySQL

Ubuntu 16.04 LTS has been out for a little while now, and its standard repos offer some nice enhancements over Ubuntu 14: Apache 2.4.18, PHP 7, and MySQL 5.7.12 The process for creating a basic LAMP web server is also streamlined, as a couple of bugs that plagued Ubuntu 14.04 are now eliminated.

To create your LAMP setup:

Install Your Web Server Packages

Ubuntu 16.04 offers current software in its main repos:

WordPress Plugin Development Tutorial

This article is intended to serve as a simple WordPress plugin development tutorial. For the purpose of demonstration we'll create a plugin that removes comment spam.

For this to work, you have to be running some sort of anti-spam system like Akismet that marks spam comments as such when they're submitted. Comments are written into a table called wp_comments in the database of your web site, and if they've been identified as spam, the word "spam" is written into their comment_approved field. Here's a look at the wp_comments table in phpMyAdmin:

PHP Zend OPcache Installation

The Zend OPcache is a caching system that seeks to improve PHP performance by keeping precompiled PHP code in the shared memory of your web server. Since PHP is an interpreted language that has to be compiled into a set of intermediate instructions ("opcodes") when someone accesses your PHP page or site, not having to perform this recompilation for every request can reduce both the response time and load on your server.

Pages

Subscribe to RSS - PHP