A HOWTO on Optimizing PHP with tips and methodologies

A HOWTO on Optimizing PHP with tips and methodologies
PHP以外でも apache とか IISにも言及しているので、なかなかいいと思う。

Finally, the HTML sent to a web client can be compressed. This is enabled by placing the following code at the beginning of your PHP script: <?php ob_start("ob_gzhandler"); : : ?> If your HTML is highly compressible, it is possible to reduce the size of your HTML file by 50-80%, reducing network bandwidth requirements and latencies. The downside is that you need to have some CPU power to spare for compression.


The second issue is that in PHP 4, echoing multiple times is slower than storing everything in a string and echoing it in one call. This is because echo is an expensive operation that could involve sending TCP/IP packets to a HTTP client. Of course accumulating the string in $s has some scalability issues as it will use up more memory, so you can see a trade-off is involved here.