PHP 7 so much faster than PHP 5

php7-transparentEarlier this year, I decided to make the leap to PHP 7 prior to it officially becoming a part of my servers distribution (I run Ubuntu).

It has probably been the easiest and best change I have made to my personal server stack in a number of years.

Granted, it wasn’t without a few minor issues. In the custom PHP code I wrote for clients, I got a little lazy over the years and did not open my PHP code blocks with <?php … and still just had php.ini to allow that, but I decided to go through my custom code and add the

Switching to PHP 7 gave a very large advantage… The speed. It is substantially faster than PHP 5. I ran benchmarks on my 1GB linode before and after the switch and PHP 7 literally doubled the speed of code execution.

Here are my basic server specs on most of my servers. There are minor variations.

Linode 1GB VPS
Ubuntu 14.04.5 LTS
MySQL 5.5.50-38.0 Percona Server
Nginx 1.4.6
PHP 7.0.9-1 (FPM)

Along with the PHP 7 switch, moving from the unmaintained Cherokee web server to Nginx as well as adding WP-Supercache to *all* my WordPress sites, the speed increase is VERY notable. Almost like I’m using a CDN when I am not. 

Between my three primary servers, I am running 53, 43 and 37 sites on each. Probably 75% WordPress, 25% Static HTML bootstrap type sites. CPU load times are never greater that 1.0 and usage rarely exceeds 5-10% (Primarily thanks to WP-Supercache).

Linode “Nextgen” upgrades

Linode “Nextgen” upgrades

Linode has invested over a million dollars into upgrading their network, servers and bandwidth to levels that are unparalleled when it comes to all the features they have already made available to subscribers.

There are three parts to the “Nextgen” upgrade so far.

The Network

“We’re spending $1 million making our network faster. Way faster. Cisco Nexus 7000 routers. Cisco Nexus 5000 switches with Nexus 2000 Fabric Extenders. Linode outbound network cap increased 5x. Outbound monthly transfer quota increased 10x.”

The Hardware

“We’re investing millions to make your Linodes faster. Crazy faster. We’ve begun a refresh of 3/4 of our entire fleet to a new ‘NextGen’ host hardware specification. And we’re upgrading all Linodes to 8 cores! Right now. As in all you need to do is reboot to double the computing power of your Linode.”

RAM Upgrade

“We’re doubling the RAM on all of our plans. This upgrade is available to existing and new customers. New Linodes will automatically be created with the new resources. Existing Linodes will need to go through the Upgrade Queue to receive the upgrades.”

These upgrades represent a MAJOR upgrade. I went from 1.2 TB of outbound to 12 TB. That is quite substantial. The 8 core hardware upgrade is a little harder for most to quantify, but it’s better than the 1-2 “visible” cores I get on DigitalOcean or other “minor” providers. The RAM went from 512 (for me) to 1024. That is very substantial as well when you determine how many sites you can run on a single 512 machine and how many more you can run with double the RAM.

I actually, to Linode’s loss, removed one of my VPS servers and moved sites over to one of the newly upgraded ones. I’m sure, once I outgrow my latest linode, I’ll expand to a new one once more, but for the time being, I love having the additional resources. For my “first” linodes and client ones, it’s great to have the additional resources, especially the “pooled” bandwidth.

Anyone who is looking for a VPS server would be stupid not to get one on Linode with all they have to offer. I manage 9 linodes split between 3 different accounts and the piece of mind that my sites are “safe” is reassuring. I have linode backups on half of them. 30 day S3 and personal rsync backups on the others and do not have to worry about my clients.

Here is my referral link.

Revolution2 – Premium WordPress Theme Collection

I love WordPress, but one thing that it’s not known for is having a really nice default theme.  It is exceptionally plain.  I’ve spent HOURS looking for nice functional themes only to download ones that “seem” nice then suck once you install them and have problems in the code that weren’t present on the screen cap.

Over the course of my journeys through many, many theme sites, I kept running across a developer whose free themes I have used before.

Brian Gardner

Revolution2His free themes are nice, clean and customizable.  The first one I used was the “Revolution Blue” (comes in red and gray too).

I ran across his site again the other day and saw that the “Revolution2” series is available and he seems to be getting together a nice group of developers and focusing in many different genres of WordPress themes, from general blogs to Real Estate, TV, Office, Photography, etc.  These new themes make WordPress act more like a true CMS system than “just another WordPress blog”.

With a few free plugins and a little effort, these themes can give any WordPress installation a nice facelift.

For the good stuff, there is a cost involved, but the cost is minimal compared to the time I have wasted trying to find a decent design for my site.  Brian also supports the themes on his website forums and if WordPress updates come out that break any of them or has new functionality, he puts out updates.  Also, his response to email is very quick (even last night, while on vacation, he responded to my email 🙂 ).  So the cost is WELL worth it.

I plan on implementing one of the Revolution2 themes over the next few weeks (as time permits).

My New Provider…!

I’ve been moving my blogs and the other’s I host through a lot of transitions lately after having a HORRIBLE experience with GoDaddy and then Compute Cycle concerns with

Mosso’s new compute cycles are heavily counting WordPress and other DB driven site hits.  5 relatively low hit blogs, ~150,000 TOTAL hits, were taking up as many Compute Cycles as one of my non-DB driven sites getting > 2,500,000 hits with lots of graphics.

I still like Mosso and most of my sites are still using email on them, but a bit more predictable monthly bill is nice.

So I happened to run across yesterday… The site is simple and clean and I was impressed at the speed of their own website. Some of the hosting providers I find while searching around have sluggish sites, which really makes me question their server/network capacity and so on.

Here is their basic blurbage from the front page of their site.


We’re just like you. Sick of oversold, underperforming, ancient hosting companies. We took matters into our own hands. We built a hosting company for people who know their stuff. Give us a box, give us bandwidth, give us performance and we get to work. Fast machines, RAID-10 drives, Tier-1 bandwidth and root access. Managed with a customized Xen VPS backend to ensure that your resources are protected and guaranteed.

  • No contracts, no setup fees.
  • Upgrade, downgrade, add a slice or remove a slice anytime.
  • Billing is monthly, cancel at anytime.
  • Payments of $240 or more receive a 10% credit.
  • Full root access and rebooting
  • Choice of Linux distro
  • Dedicated IP address and Tier-1 redundant bandwidth
  • RAID-10 disk storage
  • Reserved RAM
  • Guaranteed CPU share and more when available
  • 4-core servers running Xen virtualization instances
  • Slicehost management portal for reboots and software installs
  • Mobile management portal for smartphones
  • Ajax console access
  • Bootable rescue mode
  • Machines running with fixed usage limits, below full capacity

So I decided to go ahead and give them a try and signed up for a 256mb Ubuntu 8.04 Hardy “Slice”.  That slice is a virtual machine running on a nice large powerful server.  For $20/mo I get a VM with 256 RAM, 10GB space, 100GB bandwidth.

Some may think that’s so little, but it’s plenty to run a quite a large handful of decent sized WordPress blogs or other similiar CMS systems.  10gb is plenty for people who aren’t uploading massive uncompressed images, videos and other media.  100gb is also good especially if your web server is using mod_deflate to compress output.

Provisioning only took like 5 minutes, it was assigned a static IP and a default (hard) random root password that I went in and changed to my harder password.

I ran the apt-get install commands I used to get the lighttpd setup running on it like in my post back in April.

Basically in about 30 mins I was setup, I went ahead and moved over here and then 5 of my other friend’s blogs and am in a “testing phase” now.

Back to SliceHost…

I really like their control panel, it is very simple and sweet and has pretty much everything you need to manage your VMs.  The backup is very simple and can be automated to daily as well as a weekly. These backups are FULL VM snapshots to take your entire machine back to a previous state.

A Unique feature is an AJAX powered console to your server.  I don’t think it really full supports CTRL functions and stuff, but it’s enough to change some permissions, delete some stuff, create new folders, etc.

If you outgrow the 256mb/10gb/100gb Slice, you can scale it up, without losing data and minimal downtime, up to a 4096mb/160gb/1600gb Slice, which is 16x the power/space at only 14x the cost.  ($280)

There are also nice stats to show CPU use, CPU time, disk I/O, and network I/O.    You can do soft/hard reboots as well plus much more.

A few months ago, I had a VM of about the same size at GoDaddy running CENTOS 4 (only Linux option at the time) and it was horribly sluggish and had all kinds of “default” crap on it.  This Ubuntu install on SliceHost is virtually a base install allowing me much more flexibility over what goes on it.

The performance of it was also generally lightning fast.  I’ve used Ubuntu directly on a powerful server and it appeared just as responsive both in the console running commands and hitting the sites remotely.

Network speed was excellent as well… Got 16mbps uploading some files to it, which again, isn’t bad for a VM.

One last thing.  SliceHost is running out of St. Louis.  After pinging it from a web-based “multiping” site, it got excellent low latency from all parts of the country, as compared to hosts I’ve used on either the left or east coast, due to it’s central location.

More updates will follow as more is experienced.  I think I’ve finally found a long term home for my Linux sites.


If you are interested in signing up, click here!

Utilizing Akismet Spam Blocker in a PHP Contact Form

I have a contact form on my company’s website that I have had serious problems with in the past… The past being before I implemented Akismet into the code.

Akismet is a service provided by Automattic (the creators of WordPress) and is an excellent API based spam blocking system. I’ve been using it for quite a while on my blog and rogue spams hardly EVER make it into my comments. Probably somewhere in the neighborhood of only 1-2 out of thousands make it through.

I will post both the basic code for a contact form as well as the Akismet PHP5 Class (from Alex) and the include file I created to utilize the PHP5 Class.

Here is the basic form (named contact.php), with the PHP code on top, that I use.

include ‘akismet.php’;

$subject = $_REQUEST[“Subject”];
$message = $_REQUEST[“Message”].”<BR><BR>”.$_REQUEST[“Phone”].”<BR>”.$_REQUEST[“URL”];
$from = $_REQUEST[“Email”];

$headers = ‘From:’.$from.”rn” .
‘X-Mailer: PHP/’ . phpversion() .”rn”.
‘Content-type: text/html’.”rn”.
‘Date: ‘.date(”r”).”rn”;

mail($to, $subject, $message, $headers);

echo “Message Sent!”;
<title>My Contact Form</title>

<form action=”contact.php” method=”POST”>
<table align=”left”>
<td align=”right”>Your name:</td>
<td><input name=”Name” type=”text”></td>
<td align=”right”>Website:</td>
<td><input name=”URL” type=”text”></td>
<td align=”right”>Your email:</td>
<td><input name=”Email” type=”text”></td>
<td align=”right”>Subject:</td>
<td><input name=”Subject” type=”text”></td>
<td align=”right”>Message:</td>
<td><textarea name=”Message” style=”width: 224px; height: 83px”></textarea></td>
<td align=”right”>Your phone:</td>
<td><input name=”Phone” type=”text”>(Optional)</td>

<td> </td>
<td><input name=”Submit” type=”submit” value=”submit”></td>


contact.php includes the code I created to use the Akismet PHP5 Class mentioned earlier.

Here is the code for the akismet.php. Be sure to change the $WebsiteURL variable to your website address and $APIKey variable to the API key you already have. If you do not have one, signup for a account and you can get one free.

//Akisment PHP5 Class from Alex (
include ‘Akismet.class.php’;


//Enter your web site address below. This is used as a parameter in the API call to Akismet…

//Call to check for valid API Key…
$akismet = new Akismet($WebsiteURL, $APIKey);

//Check to see if your API key is valid, if not, it will tell you so and stop.

if($akismet->isKeyValid()) {}else{echo “Your API key is NOT valid!”;die();}


//CHANGE the $_REQUEST items to match your form field input element names

$akismet = new Akismet($WebsiteURL, $APIKey); //


if($akismet->isCommentSpam()) {
echo “For some reason, your message was flagged as a possible SPAM message.”;


Click here to download a ZIP of the three files used in this example.

If you have any questions, leave a comment here and I’ll do my best to answer in a timely manner…

My first look at Ubuntu 8.04 LTS as a Desktop and Server

Last week, after much waiting by myself, Ubuntu 8.04 LTS came out. Before the release, I didn’t have the time to really mess around much with the BETAs or the last Release Candidate, but the morning it was released, torrenting commenced and went to work.

Got home, burned it to a CD and installed it on my primary Windows workstation (running Vista) using the Wubi Installer.

For those of you not familiar with Wubi, here is the blurb from their website:

“Wubi is an officially supported Ubuntu installer for Windows users that can bring you to the Linux world with a single click. Wubi allows you to install and uninstall Ubuntu as any other Windows application, in a simple and safe way. Are you curious about Linux and Ubuntu? Trying them out has never been easier!”

So basically, you can install Ubuntu into C:ubuntu then when rebooting your machine, you will have another option to boot to besides Windows… The Wubi Installer by default only created a 12gb “container” for the Ubuntu installation. If you plan on actively using Ubuntu under Wubi, make it as large as you can do without, space wise, in Windows. It can get a bit geeky to add more space to the Wubi side after the fact. I didn’t realize it at the time and went with the 12gb, but then I wanted to run XP inside a Virtual Machine, which didn’t leave me much space left. I ended up Googling around and found a method to create a second Wubi disk and copy over your /home/ folder to it and changing your fstab to use it. So I had the 12gb for system stuff and another separate 25gb /home/ disk image.

The best thing about Wubi is that it allows you to test out Ubuntu on your machine without wiping out anything, no re-partitioning, no real impact on your system at all. You do take a slight performance hit since you are running this off a file on the NTFS file system, but the hit isn’t anywhere near as much as running it from VMWare, which doesn’t help if you are looking to see if Ubuntu is truly compatible with your hardware.

First Install as Desktop

Here are my basic system specs of my first install:

Lenovo something…
AMD 64 X2 3800+
2048mb RAM
250gb HDD
nVidia GeForce 8600GT XFX XXX w/ 256mb RAM
22″ Samsung wide screen @ 1680×1050
19″ Samsung @ 1280×1024

The installation was a breeze and all I had to do was set my network information to get online (I don’t use DHCP on my router).

The nVidia “restricted” driver took a few minutes to download and install due to the mass deluge of downloaders hitting Ubuntu’s (and mirror) servers. Response time for all APT-GET queries were a bit slow over the weekend. It calmed down some on Sunday and I was able to get things done quickly.

Setting up the Beryl/XGL effects were easy once the aforementioned driver was enabled, but Ubuntu leaves out the “advanced” configuration options for the effects. Again, googling around, I was able to find the “apt-get” commands to get those utilities installed.

Probably the longest thing to get working was the true dual display.

Just after installing Ubuntu, both monitors had the same output. After installing the nVidia drivers, the secondary screen dropped out, but there was no explanation for it and no setting in the display properties would bring it back. Googling mentioned a program called “nvidia-settings” which I ran and after much tinkering was able to get a solid xorg.conf created to have the 22″ monitor primary and the 19″ as a secondary span to the first.

Needing to work a lot in the Windows world, I keep a Raw XP VM Machine around that is patched (mostly) and ready to unzip and load to install the few Windows based utilities I need like Adobe Photoshop (doesn’t work well under Wine) and Microsoft Expressions/Visual Studio. Installing VMWare Player took a bit of hacking around, but installed fine. I used the secondary monitor to full screen XP while keeping Ubuntu on the primary.

Overall, things are MUCH better under 8.04 than any of the previous Ubuntus in my opinion. Googling around for things was key for me. Be sure to include “8.04” in your search queries to limit the number of older pages from being returned. Some of those instructions are way out of date with 8.04.

Later this week, I am going to try my “dad test” on Ubuntu to see if he can handle it, I did install it on his machine, but had trouble getting his Wireless to connect to one of my many access points (He lives across the street with a WiFi repeater in his office). I think the driver is just flaky.

Might end up just putting an Ethernet bridge on his PC so it’ll just use his ethernet port which looked fine.

Second Install as Server

System Specs:
Dell SC430 Server
Intel Pentium D Dual Core 2.8ghz
1gb RAM
160gb SATA HDD
Integrated Video
17″ Viewsonic LCD

As has been usual with the later Ubuntu builds, Installation was a breeze. This time, I wiped out the parition completely and installed it directly on the box which made it very fast compared to the Wubi install above, which isn’t bad to begin with.

For this installation, I was more server focused, but did not install the “server” version of Ubuntu. I opted to use the same “desktop” version and install all the packages I needed to make it a “server”.

Doing a lot of WordPress Installations, I chose to get a Virtual host WP environment setup.

I’ve been hearing a lot of good about LighttpD lately and decided to apt-get that instead of Apache2.

LighttpD is a VERY fast alternative to Apache2 (up to 50% faster in some cases). Setting it up was as easy as “apt-get install lighttpd” (After removing Apache2).

# apt-get remove apache2.2-common
# apt-get install lighttpd mysql-server php5-cgi php5-mysql

I also grabbed PHP-CGI and did a little tweaking to get lighttpd to parse the PHP files using FastCGI which was not difficult.

# lighty-enable-mod fastcgi

Had to edit the /etc/lighttpd/conf-enabled/10-fastcgi.conf to get my paths correct.

Googling around gave me the conf file lines I needed for the Virtual host config:

For a single hostname like

$HTTP["host"] == "" {
server.document-root = "/your/www/path"

for use this…

$HTTP["host"] =~ "(^|.)$" {
server.document-root = "/your/www/path"

Put as many as you need in there. I used a spare domain and pointed * over to it and setup a few virtual hosts to test them.

Restart Lighttpd using:

/etc/init.d/lighttpd force-reload

I had a LLMP (Linux, Lighttpd, MySQL, PHP) server setup and ready to go.

Download the latest WP files:

curl -o latest.tar.gz

Uncompress them to the virt root of your choice and be sure to chmod the folders correctly so WP can run the setup and create the wp-config.php file.

To make Permalinks (friendly URLs) work, just add this into the lighttpd.conf before (or within) the virtual host directives…

server.error-handler-404 = "/index.php"

This will allow the permalinks to work correctly, mod_rewrite rules are not necessary.

There may be a little more to all this than the above instructions, depending on your configuration. The information provided was to just provide basic guidance.

My plans are to eventually backup all the WP blogs on host on my dedicated server and curl them over to this Ubuntu box, uncompress them, drop and restore the databases and have a mirror of them offsite from the dedicated server in case anything ever happens. This should be easiest enough to do in a few hours in one script file on the server to do the backups and database dumps into one compressed file, then another cron’ed script on the local Ubuntu to curl it down and restore everything. If anything ever goes wrong, just change the DNS for the domains and point them to my local Ubuntu which can be DMZed on my router. 🙂