The previous article in this series talked about how to set PHP up so that it’s a lean mean processing machine. Now we get to make sure that our PHP code follows suit.
Also read part 1 of this article.
I’ll cover 10 lesser known PHP functions or methods that can help streamline your PHP code. Read the rest of this entry »
Tags: apache, howto, performance, php
11 Comments »
I’ll be the first to state that there is no shortcut to making your PHP applications scream. This series aims to break it down into several steps. The first step will be taking a look at the PHP configuration on the server. We’ll be focusing specifically on PHP this article as a later article will cover 3rd party software which are an essential part of scaling your applications. Comments and suggestions welcome!
Also read part 2 of this article.
PHP.ini, getting your hands dirty
Almost all of the PHP configuration options are available in your php.ini file. PHP ships with several defaults which are suited for compatibility and not for performance. Let’s change that! It’s important to understand your application and what you can and cannot change. In some cases you might want to have allow_url_fopen = On even though I would generally recommend against it. Keep that in mind when reading this list. Read the rest of this entry »
Tags: apache, howto, performance, php
1 Comment »
I decided to embark on figuring out how to make my site as fast as possible. There were a few tips I was already aware of but decided to grade myself using YSlow. My initial score was bad, an F. I realized I had to do a few things.
- Compress text/* files using gzip
- Decrease HTTP requests by combining multiple JavaScript (and CSS) files into single files
- Add aggressive caching since the site isn’t updated very often (especially images, JavaScript and CSS files)
Here’s what my original scores looked like. Read the rest of this entry »
Tags: apache, howto, javascript, performance, php
8 Comments »
JSON is the perfect format for passing data from a server to JavaScript. With the prototype.js the JSON string sent by the server is automatically evaluated to a native JavaScript datatype. In order to do this you need to pass the data back with a content-type of application/json.
Step 1
First we’ll need to set up a script (PHP in this case) on the server to return a JSON string and specify the content type. This is easily done using the following code: Read the rest of this entry »
Tags: ajax, howto, json
No Comments »
I noticed that DZone had a really cool UI for a list of user submitted links. DZone is similar to Digg but geared more towards programmers. The premise is that a small subset of links are populated when the page loads. Once the user begins to scroll and nears the bottom of the list it automatically populates more stories to the end. This is a great alternative to having numerous pages that the user has to click through. You can also view a working example. Read the rest of this entry »
Tags: ajax, howto, javascript
8 Comments »
This step by step guide will help you get set up with EpiCode (documentation) in under 15 minutes. EpiCode is a framework that maps URLs to static methods. It also has a few utility functions to make templating completely painless. There’s no new templating syntax to learn since PHP does a great job at that already. EpiCode also handles variable scope so you don’t have to worry about mucking up the global namespace. Read the rest of this entry »
Tags: apache, php, programming
12 Comments »
Earlier today I was receiving a failure response when using YUI’s YAHOO.util.Connection.asyncRequest method to make an ajax call. The YUI documentation on this doesn’t help too much when troubleshooting the problem so we need to figure out what the heck is going on. Read the rest of this entry »
Tags: ajax, howto, javascript
No Comments »
Per Wikipedia, a closure is defined as “a function that is evaluated in an environment containing one or more bound variables“.
What’s a closure look like? Read the rest of this entry »
Tags: howto, javascript, programming
No Comments »