Whenever I’m brought in to improve the performance of a PHP application, an easy change I make is to disable any PHP extensions that the application does not use. PHP extensions are code libraries written in C that add to PHP’s native functionality. Examples of popular extensions on IBM i are ibm_db2 and curl.
Boost performance by disabling unneeded extensions
I’ve noticed that Zend Server ships with most extensions enabled, presumably so that developers won’t have to see “extension not enabled” error messages. While the default configuration is fine as a starting point, developers should understand that each extension requires memory when loaded. When every bit of performance counts, it’s best to disable the unused extensions. Note: don’t disable anything till you read Several Extensions to Keep Enabled.
Managing PHP extensions
To manage extensions, Zend Server provides the “Server Setup / Extensions” tab. Each extension can be enabled or disabled with its “Turn on” or “Turn off” links. Changes do not take effect until the “Restart PHP” button is clicked.
Storage location for extension settings
Zend Server stores extension settings in a set of .INI files, one file per extension. On IBM i, the files are located in /usr/local/ZendSvr/etc/conf.d. Before making large-scale changes, you may wish to back up this folder. Then, if you discover you were overzealous in disabling extensions, you can compare the contents of conf.d with your backup to find out where you went wrong.
In addition to whatever extensions are required by a given application, I’ve found that several extensions are required by Zend Server itself. Do not disable these. So far, I’ve found that Zend Server requires these extensions to be enabled:
- simplexml (used by new open source toolkit)
If you accidentally disable an extension required by Zend Server, which you’ll discover when Zend Server fails to start properly, you must re-enable the extension in the correct .INI file and then restart Zend Server from a command line or menu. On IBM i, the command is STRTCPSVR SERVER(*HTTP) RESTART(*HTTP) HTTPSVR(ZENDSVR).
More performance tips to come
I plan to write about more techniques to improve PHP application performance, particularly on IBM i, that I’ve found to be effective in my consulting experience. Performance is a critical part of user experience that developers should not ignore. In addition to this practical need for good performance, I can speak for myself, at least, in saying I feel great satisfaction when I can take a slow application (sometimes the victim of an underpowered server) and, step by step, help it run faster and faster, till the performance is at least acceptable and sometimes quite fast. More to come.