Skip to main content

Posts

Showing posts from August, 2012

Optimizing PHP

The more you understand the software you are using (Apache, PHP, IIS, your database) and the deeper your knowledge of the operating system, networking and server hardware, the better you can perform global optimizations on your code and your system. Try to use as much caching as possible, typically I would use this configuration: Squid -- PHP and memcache or file caching -- Database. For PHP scripts, the most expensive bottleneck is normally the CPU. If you are not getting out of memory messages, more CPUs are probably more useful than more RAM. Compile PHP with the "configure –-enable-inline-optimization" option to generate the fastest possible PHP executable. Tune your database and index the fields that are commonly used in your SQL WHERE criteria.  ADOdb , the very popular database abstraction library, provides a  SQL tuning mode , where you can view your invalid, expensive and suspicious SQL, their execution plans and in which PHP script the SQL was executed. Use