18.2. Tuning PHP

Tuning PHP is much harder than tuning the database because scripts are always executed the same way. However, some basic things can be changed to achieve higher performance. In this section you will see what can be done to make PHP run even faster.

PHP can be used in two ways: One way is to run PHP as a Web server module so that it is called by Apache. The other way is to run PHP using the CGI interface. When you use the CGI interface, a process is started whenever a request is sent to the Web server. When the process is started, php.ini has to be read so that PHP can find out which parameters have been set. This takes some time and can cause significant overhead. After that the script is executed.

In the case of PHP as a module, ...

Get PHP and PostgreSQL: Advanced Web Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.