10 ways to boost PHP’s speed

10 ways to boost PHP’s speed [Message #1]

1.A PHP script will be served at least 5-10 times slower than a static HTML page by Apache. Try to use more static HTML pages and fewer scripts.

2.Enable the compression of HTML by putting in your php.ini:output_handler = ob_gzhandler

3.Install a PHP caching suite. I have personally used zend (commercial), turck mmcache, and ioncube, and they all work very well.

4.Switch from file based sessions to shared memory sessions. Compile PHP with the –with-mm option and set session.save_handler=mm in php.ini. This can drastically improve session management performance.

5.Another caching technique that can be used when you have pages that don’t change too often is to cache the HTML output of your PHP pages. (a list of template solutions is posted within one of my previous articles).

6.Use output buffering (See ob_start). This will speed up your PHP code by 5-15% if you frequently print or echo in your code.

7.On Windows, FastCGI is the highest performance way of running PHP with Apache.

8.In PHP4, objects and arrays should be passed to functions by reference (with &), and everything else by value. In PHP5, objects are already passed by reference.

9.Don’t use images when text will do. Reduce your image sizes with a software like MacroMedia Fireworks or imagemagick.

10.If possible, Run your database server on a different machine. If all static content is served from another server, then you can turn off KeepAlives in httpd.conf to speed up client disconnects.

http://www.whenpenguinsattack.com/

Advertisements
  1. ยังไม่มีความเห็น
  1. No trackbacks yet.

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out / เปลี่ยนแปลง )

Connecting to %s

%d bloggers like this: