PHP error guide
PHP reports no loaded php.ini: meaning and fix
Error summary
Inspect the compiled configuration path and scan directory, then provide a readable ini file for the affected SAPI or an explicit -c path.
What it means
Inspect the compiled configuration path and scan directory, then provide a readable ini file for the affected SAPI or an explicit -c path.
What the error means
PHP started without a primary php.ini file, although it may still scan additional .ini fragments.
Why PHP produces it
No readable file exists at the discovered path, -n disabled configuration loading, or environment variables redirected discovery.
PHP version notes
The behavior described for PHP reports no loaded php.ini applies to PHP 7.4–8.4 unless a narrower version is stated; exact wording can vary by SAPI and patch release.
Most common causes
- The CLI command includes -n.
- The expected php.ini was never copied from a packaged template.
- PHPRC points to a missing path.
Minimal examples
BAD — reproduces the problem
php -n app.php
FIXED — safer pattern
/usr/bin/php8.3 -c /srv/app/config/php.ini app.php
Step-by-step diagnosis
- Run php --ini and php -i using the affected binary.
- Check Configuration File (php.ini) Path and Scan this dir for additional .ini files.
- Inspect PHPRC, command flags, permissions, and service startup arguments.
Fixes
Load an intentional configuration
Create or select a site/SAPI-specific ini and verify it is reported as loaded.
/usr/bin/php8.3 -c /srv/app/config/php.ini --ini
Common mistakes when fixing it
- Copying a development ini into production without review.
- Assuming no primary file means no scanned fragments.
- Editing another PHP version’s configuration.
How to prevent it
- Verify loaded_ini_file and scan paths during deploy.
- Manage configuration per SAPI.
- Protect ini files containing sensitive paths.
Web server / environment notes
cli, fpm, apache. Primary and scanned configuration discovery is SAPI-specific.
Tags: cli,fpm,apache