Better ways to improve php application performance
Google recently released a document on how to improve PHP performance here. Most of the tips listed here will not help you improve performance by any significant amount. The following is a list of things that you can do that will improve the performance of your web apps significantly.
1) object code caching
Each time a request comes to your server for a php script, it has to go through the compiler and then execute the object code. If this is cached, the 1st step is skipped and you end up with a faster and more responsive script.
There are many object code caching packages available on the Internet:
A) Ioncube: http://www.ioncube.com/
B) Zend Encoder: http://www.zend.com/products/zend_safeguard
2) Template systems
Template systems provide a different type of caching. Content caching. Template systems work well in a situation where there is static data on one or many of your pages that doesn’t have to be reloaded. Caching systems also provide a separation of code and html, which will not only improve completion time of the overall project, but make it easier for future improvments. Most template systems for php are available for free:
A) Smarty Templates: http://smarty.php.net/
B) Pear Templates: http://pear.php.net/package/html_template_it/redirected
C) PHP savant: http://phpsavant.com/yawiki/
3) Distributed object caching systems
The most widely used system of this type is memcached (http://www.danga.com/memcached/).
This type of system makes your overall site faster by caching the majority of your database data into a large memory pool.
more on memcached:
“Danga Interactive developed memcached to enhance the speed of LiveJournal.com, a site which was already doing 20 million+ dynamic page views per day for 1 million users with a bunch of webservers and a bunch of database servers. memcached dropped the database load to almost nothing, yielding faster page load times for users, better resource utilization, and faster access to the databases on a memcache miss.”
4) PHP variables that can be set
variables_order = ‘GPC’
register_argc_argv = ‘Off’
register_globals = ‘Off’ (this is a good idea to keep off for security purposes as well)
always_populate_raw_post_data = ‘Off’
magic_quotes_gpc = ‘Off’
Disable Error Logging. This is a good idea to keep on when you are developing your scripts, but it has been known to decrease overall performance.
Use IP addresses, rather than host names to access your database. Although this is sometimes not possible, you will get a slight boost in lookup speed if the IP address is used to access your database rather than its hostname.
5) Output Compression
Almost all browsers these days support something called gzip compression. Gzip compression can decrease the overall size of your output by up to 80%, but with a tradeoff: cpu usage will go up by around 10%. The benefit of using this compression type is the fact that not only will your bandwidth be decreased, but your pages will load faster.
enabling it in php (add the following lines to php.ini):
zlib.output_compression = On
zlib.output_compression_level = (level) (where level is 1-9. Youy may want to try different values to see what is best for your system).
if you are using apache, you can also enable the mod_gzip module. It is highly configurable, with the ability to modify output based on MIME types, files, or browser settings.
6) Other things that may help
when using a database, only retrieve the data that you are actually going to use. This may sound like a no-brainer, but I have often times worked on projects where the original programmer used (select * from mytable) when they could have used (select fieldIneed from mytable).
index database tables whenever possible
Learn more about this Here
June 25, 2009 13 Comments
5 ways to extend firefox tabs
The following are 5 Firefox extensions that will extend tab functionality.
1) IE tabs

This is a great tool for web developers that allows you to view web pages in Internet Explorer within a firefox tab.
Download Here
2) Informational tab

This extension provides thumbnail-style preview for each tab, does progress meter, and indicates unread status.
Download Here
3) Tab Mix Plus

Tab Mix Plus enhances Firefox’s tab browsing capabilities. It includes such features as duplicating tabs, controlling tab focus, tab clicking options, undo closed tabs and windows, plus much more. It also includes a full-featured session manager with crash recovery that can save and restore combinations of opened tabs and windows.
Download Here
4) TabSidebar
Features:
- Provides navigation options for each tab including history, stop and reload.
- Allows you to move tabs around with drag and drop.
- You can drop links, local files and bookmarks anywhere you like in the tab list.
- Displays the security status of tabs.
- Automatically refreshes the tab preview whenever the page changes.
- Lets you hide the main tab bar when the sidebar is open.
- Bidirectional support making the sidebar work correctly in right-to-left languages.
- Works well with other tab-related extensions allowing you to use their context menu additions from the sidebar.
Download Here
5) Tab Effect

This adds a tab switching cube effect to Firefox.
Download Here
May 4, 2009 No Comments
How to break the DiggBar
Recently, digg.com added a new feature called the “DiggBar”.
It frames your page and auto-generates a short url for your content. The issue many people have with this is that the user never leaves the Digg website, which is bad for SEO. This is because:
- Users will most likely link to the shortened Digg URL, and not your site
- Even when a user clicks on your links, it still seems like it is part of digg, not a separate, external link.
- Eventually, they could place advertising on this toolbar, competing against any ads on your page

Recently, because of many criticisms, Digg has changed the behavior of the bar (taken from the Digg blog):
1. New treatment to the behavior of Digg short URLs. All anonymous users, on or off Digg will be taken directly to the publishers content via a permanent redirect (301), no toolbar, straight to the site. Logged in users that have not opted out will continue to see the DiggBar (200). These changes ensure that content providers receive full search engine ‘juice’ or credit for all links on and off Digg. They also ensure that Digg short URLs won’t appear in the indexes of any major search engines.
2. Because we want to ensure the best user experience, the DiggBar will soon only be shown to you when you are logged into Digg. While the vast majority of Digg users find the DiggBar valuable (only a very small number of users have disabled the feature or hit close with any frequency) we understand that many folks were confused when opting out. We want you to be able to have the option to permanently disable the DiggBar with ease. For registered Digg users receiving the bar, we are also making a few changes to make the process more obvious.
However, people can still get to your content through their service if they are logged into their account when viewing.
The following code will remove the DiggBar (and auto-redirect to your actual content) the user to the actual link. To use, place in the header of your website. It will also prevent other sites from displaying your content in an iframe.
if (top!= self) top.location.href = location.href;
</script>
April 28, 2009 No Comments