Archive for June, 2007

Apache and PHP performance tips, tricks and what I call database buffering

I’ve found a couple useful web sites to help tune Apache with PHP on web servers.

phpLens has a pretty detailed page on the subject that hits everything pretty well.

Link: http://phplens.com/phpeverywhere/tuning-apache-php

For the most part I agree with everything this page says.  I do have a few other suggestions though.

Addressing the 3rd suggestion on the phpLens tuning Apache and PHP post, I recommend turning compression on for specific content types using the mod deflate module in Apache 2.0 or greater.  Apache 1.3 uses a different compression module which is a bit more complicated to setup.  Here is a link on ClarkConnect that describes how to add the deflate support to your web site and track its statistics with awstats.  Don’t forget to compress javascript, css and xml as well as html.

Link: http://www.clarkconnect.com/wiki/index.php?title=Howtos_-_Activating_content_compression_on_Apache

Web server or module level PHP accelerators seem ideal for speeding up the performance of php scripts.  Though the 6th suggestion, I would debate whether caching pages in the PHP level is faster or not.  Libraries like Smarty are great for templating your pages but they have their limits.  If you are hosting a web site with constantly changing dynamic content, the caching built into Smarty is minimal at best.  Granted that your original PHP script was well written, the cached Smarty version technically can’t re-optimize your database queries, which is most likely the source of any delays with a dynamic web page.

One suggestion that is missing from the post is optimizing your SQL queries and methods how you select the data.  phpLens mentions the concept of output buffering.  What I am about to explain is similar and should be deployed together.  First and for most, when you are working with a result set of data from a database, loop through all the data and store it in variables as quickly as you can and free up that queries resource.  This will use the time you are connected to the database as efficiently as possible and prevent you from accidentally creating nested queries.  Since this practice is very similar to output buffering, perhaps we should call it ‘database buffering’.  The database may still buffer data as well, but your script knows better than the database what to do with the selected data and your script definitely knows what queries are going to happen next.  Database buffering practices just make sense.

I would also recommend testing your web sites for security issues.  Check out Nikto, it is a pretty powerful web server scanner that looks for vulnerabilities and security issues.

Link: http://www.cirt.net/code/nikto.shtml

Freeware CD/DVD burning application – InfraRecorder

If you are looking for a full featured and simple to use CD/DVD burning application, look no further. Check out InfraRecorder found at Source Forge.

Link: http://infrarecorder.sourceforge.net/

I just used it to do some basic burning and it worked beautifully. It’s light weight and gets you going. Check it out!

VS.PHP – IDE, Debugger, WYSIWYG HTML Editor

Wow.  I am blown away.  I think the pricing is just a tad too high though.  I would recommend selling the Standalone Edition for $100 and the for Visual Studio Edition for $75.  Anythign prices over $100 is a hard sell.  Lucky for me I have a copy of Visual Studio Standard I got from a Podcast promotion from Microsoft last year.

VS.PHP Web Site

I am hoping that the debugger in this product works well.  This is the one thing that PHP lacks.  So far I’ve confirmed that it is not a Dreamweaver replacement.  It does not have a split view for editing HTML and it does not treat PHP pages the same as HTML pages.  I would like to edit my PHP in a design view.  Most likely the developers of this application do not consider the spaghetti coding style as a way their program should be used.

Compiled Weekly

This week on CompiledWeekly, Angelo explains how to install, setup and use a Subversion revision control system.  Learn about the basic concepts and how to use TortoiseSVN from Windows Explorer.

Check it out: www.compiledweekly.com/podcast/

CW9 – June 3, 2007 – Subversion revision control system

One Topic:Subversion, a open-source, cross platform revision control system. Tonight I talk about how to install, configure and understand how to use a Subversion repository.

Don’t forget to E-mail comments and suggestions to compiledweekly AT gmail.com.

File Download (14:46 min / 10.2 MB)

Blubrry player!