Get expert guidance in a few days with a Laravel code review

PHP 8.5 Introduces an INI Diff Option

Last updated on by

PHP 8.5 Introduces an INI Diff Option image

PHP 8.5 introduces a diff option for the php --ini flag that makes it easy to identify changed INI values in your configuration. The --ini flag is helpful to show the loaded php.ini configuration file, as well as additional .ini files parsed:

$ php --ini
Configuration File (php.ini) Path: "/usr/local/etc/php"
Loaded Configuration File: "/usr/local/etc/php/php.ini"
Scan for additional .ini files in: "/usr/local/etc/php/conf.d"
Additional .ini files parsed: /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini,
/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini,
/usr/local/etc/php/conf.d/zz-app.ini

Starting in PHP 8.5, you can use diff as follows to show you INI values that are different from built-in default values:

$ php --ini=diff
Non-default INI settings:
allow_url_include: "0" -> ""
auto_append_file: (none) -> ""
auto_prepend_file: (none) -> ""
display_errors: "1" -> ""
display_startup_errors: "1" -> ""
enable_dl: "1" -> ""
error_reporting: (none) -> "22527"
...

Try it out

As of July 3, 2025, PHP released the first alpha version of the upcoming 8.5 version. While builds are available, the easiest way for you to experiment with PHP 8.5 is going to be using the official PHP Docker containers.

Let's walk through how to experiment with the new php --ini=diff flag and other PHP features like The Pipe Operator. If you want to follow along, you can create a new folder with a Dockerfile and a few other example files:

mkdir php-85-demo
cd $_
touch Dockerfile
mkdir php/
touch php/app.ini

Before we make changes, we can quickly see what INI values have changed in the official PHP image:

docker run --rm -it php:8.5-rc-alpine sh
 
# in the Docker container
php --ini=diff
Non-default INI settings:
html_errors: "1" -> "0"
implicit_flush: "0" -> "1"
max_execution_time: "30" -> "0"

We ran a container using the 8.5-rc-alpine tag and can see that out of the box, the PHP image changes three INI settings. If you look carefully, the PHP image doesn't load an INI file by default, so it's almost 100% defaults:

$php --ini
Configuration File (php.ini) Path: "/usr/local/etc/php"
Loaded Configuration File: (none)
...

Usually, you'll copy the premade php.ini files that ship with the Docker PHP image — let's use the production INI template to see what non-default INI values change when using the production php.ini file:

FROM php:8.5-rc-alpine
 
RUN cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
COPY php/app.ini $PHP_INI_DIR/conf.d/app.ini

Our Dockerfile copies the php.ini-production INI file into the path PHP expects the php.ini file. Next, we copy an example app.ini file that is in the path PHP loads additional INI files.

Next, let's add a custom setting to our php/app.ini file that will show up in our diff:

memory_limit=512M

If we build our image and start a container, we can check what diffs we have:

$ docker build -t php85-demo .
$ docker run -it --rm php85-demo sh
 
# Inside the Docker container
$ php --ini=diff
Non-default INI settings:
allow_url_include: "0" -> ""
auto_append_file: (none) -> ""
auto_prepend_file: (none) -> ""
display_errors: "1" -> ""
display_startup_errors: "1" -> ""
enable_dl: "1" -> ""
error_reporting: (none) -> "22527"
html_errors: "1" -> "0"
ignore_repeated_errors: "0" -> ""
ignore_repeated_source: "0" -> ""
implicit_flush: "0" -> "1"
log_errors: "0" -> "1"
mail.add_x_header: "0" -> ""
mail.mixed_lf_and_crlf: "0" -> ""
max_execution_time: "30" -> "0"
memory_limit: "128M" -> "512M"
mysqlnd.collect_memory_statistics: "0" -> ""
request_order: (none) -> "GP"
session.cookie_httponly: "0" -> ""
session.gc_divisor: "100" -> "1000"
short_open_tag: "1" -> ""
unserialize_callback_func: (none) -> ""
user_dir: (none) -> ""
variables_order: "EGPCS" -> "GPCS"
zend.assertions: "1" -> "-1"
zend.exception_ignore_args: "0" -> "1"
zend.exception_string_param_max_len: "15" -> "0"
zlib.output_compression: "0" -> ""

The production INI file contains several changes to the default INI values. What's neat is that we can quickly see everything that's different without having to cross-check values in the php.ini file.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Filed in:
Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Bacancy

Outsource a dedicated Laravel developer for $3,200/month. With over a decade of experience in Laravel development, we deliver fast, high-quality, and cost-effective solutions at affordable rates.

Visit Bacancy
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit

The latest

View all →
Detecting and Fixing Race Conditions in Laravel Applications image

Detecting and Fixing Race Conditions in Laravel Applications

Read article
LaraCopilot: Generate Laravel MVPs From a Single Prompt With AI image

LaraCopilot: Generate Laravel MVPs From a Single Prompt With AI

Read article
Model::withoutRelation() in Laravel 12.54.0 image

Model::withoutRelation() in Laravel 12.54.0

Read article
Tyro Checkpoint: Instant SQLite Snapshots for Laravel Local Development image

Tyro Checkpoint: Instant SQLite Snapshots for Laravel Local Development

Read article
The Laravel Community Mobile App Helps You Discover Events and Connect With Developers image

The Laravel Community Mobile App Helps You Discover Events and Connect With Developers

Read article
A PHP Package for Concurrent Website Crawling image

A PHP Package for Concurrent Website Crawling

Read article