Category: Development

  • Are you having CakePHP and NGINX Rewrite Rule Issues?

    In a recent blog post – It’s LEMP Not LAMP – I discussed about making the switch to using NGINX (pronounced Engine-X).  I had little-to-no issues getting by basic WordPress blogs up and running.  However, for some reason I couldn’t get my older CakePHP sites up and working.

    I was racking my brain forever, trying everything I could think of with the rewrite rules – thinking for sure this must be the root of the cause.  In the end I thought it might just be an issue with the version of CakePHP I was using, as it was an older version (1.2.x).  However, I just grabbed a clean copy from CakePHP’s Github of 1.2.10 and got it up and running without issues.

    I’m of course even more confused at this point, so why am I writing this blog post you ask?  The answer is simple, if you’re having issues with getting an old CakePHP site to work on NGINX, try upgrading your CakePHP version. (more…)

  • What I Learned This Summer

    Well – it’s Friday and all of the kids are back in school.  While this post is being published, I’m probably stuck in traffic!  I can’t believe it’s a new school year already, luckily my kids aren’t old enough so it’s just traffic that I need to get used to.

    This has been a great summer so far and I thought it would be a good idea to summarize the variety of things I’ve learned about – but have not necessarily blogged about…

    (more…)

  • It’s LEMP not LAMP!

    I’m sure many of you have heard the term LAMP before – standing for Linux Apache Mysql and PHP.  This is a very typical setup for many open source websites.  It’s been around for ages.  But make way for LEMP.  In a recent report by w3techs, a new HTTP server is climbing its way up the ranks called nginx, but it is pronounced Engine-X; hence, the term LEMP – standing for Linux Engine-X (nginx) Mysql and PHP.

    According to this w3techs report nginx is now used by almost 12.5% of the websites we know what web server they are running on.  More significantly a staggering 28.2% (of the 12.5%) websites rank in the top 1,000 worldwide (according to their Alexa ranking).

    Along with my recent switch to Amazon EC2, I also decided to switch to a LEMP stack.  I thought I should throw out another shout out to HowToForge.com for this AMAZING step-by-step tutorial on installing a LEMP stack with extremely simple to follow instructions on my brand new Ubuntu 12 server.

    Check out the step-by-step instructions to setting up your LEMP server.

    I think I only had to make one modification to this instruction set before being able to perform one of the apt-get install commands I had to perform an update on the box.  Luckily enough, the OS told me exactly what to do!

    A friend and former colleague introduced me to nginx a while back with his blog about Setting up WordPress with nginx and FastCGI.  This is quite useful for understanding the nginx configuration for a virtual host that requires rewrite rules as nginx currently has no support for .htaccess files!

  • A Simple But Effective Speed Comparison

    A little while ago, I wrote a simple .NET application that performs X amount of requests and calculates an average speed of those requests.  It does this by dropping the highest and lowest request times, then taking an average speed on the remaining requests.

    This does a decent job for a straight up speed test.  However, a few possibilities could arise, such as CPU hogging that could skew the results.  Instead, I’ve made a few alterations and converted the speed tester to not be based on the number of requests, but instead based on a specific amount of time.  This should help eliminate some inconsistencies of doing a straight number of requests.

    (more…)

  • PHP: Require/Include vs Autoloader

    Google has long since ingrained into my brain how important every millisecond is when dealing with large amounts of traffic.

    In this post, I’m going to demonstrate a really simplistic way to improve your PHP website performance.  It seems to go against the grain of “old school” vanilla PHP writing, but the results are incredible!  By removing the use of require and include and replacing it with a spl_autoload_register function instead, the time savings are more than 10 times!

    Not only that, in theory it’s less lines of code!

    (more…)