Skip to Content
Modern PHP
book

Modern PHP

by Josh Lockhart
February 2015
Intermediate to advanced
268 pages
5h 51m
English
O'Reilly Media, Inc.
Content preview from Modern PHP

Chapter 8. Tuning

By this point, your PHP application should be running alongside Nginx with its own PHP-FPM process pool. We’re not done yet, though. We should tune PHP’s configuration with settings appropriate for your application and production server. Default PHP installations are like an average dress or suit you find at your local department store; they fit, but they don’t fit well. A tuned PHP installation is a custom tailored dress or suit prepared with your exact measurements.

Don’t get too excited. PHP tuning is not a universal cure for application performance. Bad code is still bad code. For example, PHP tuning cannot solve poorly written SQL queries or unresponsive API calls. However, PHP tuning is a low-hanging fruit that can improve PHP efficiency and application performance.

The php.ini File

The PHP interpreter is configured and tuned with a file named php.ini. This file can live in one of several directories on your operating system. If you run PHP with PHP-FPM, as I demonstrated earlier, you can find the php.ini configuration file at /etc/php/7.0/fpm/php.ini. Oddly enough, this php.ini file does not control the PHP interpreter used when you invoke php on the command line. PHP on the command line uses its own php.ini file often located at /etc/php/7.0/cli/php.ini. If you built PHP from source, the php.ini location is likely beneath the $PREFIX directory specified when you configured the PHP source files. I’ll assume you’re running PHP with PHP-FPM as described, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Learning PHP

Learning PHP

David Sklar
PHP Cookbook

PHP Cookbook

Eric A. Mann

Publisher Resources

ISBN: 9781491905173Errata Page