Key facts
- There is no single official standard; each program defines its own rules for comments, quoting and duplicate keys.
- Comments usually start with ; and sometimes #; sections are written in square brackets such as [PHP].
- Usually served as text/plain; files are small, typically a few KB.
- PHP reads php.ini once at startup (per PHP-FPM pool or web server process), so edits need a restart or reload.
- Related formats include .cfg, .conf, .user.ini (per-directory PHP settings) and TOML, which formalises the INI style.
How to open a .ini file
Right-click and open with Notepad or Notepad++. Files under Program Files may need an editor run as administrator to save.
Open it with TextEdit (in plain-text mode) or a code editor such as VS Code; use sudo nano for system files in Terminal.
Edit it with nano or vim, for example sudo nano /etc/php/8.3/fpm/php.ini, and run php --ini to see which php.ini files are loaded.
Common problems and fixes
- Changes to php.ini have no effect
- You edited a different php.ini from the one in use, or did not restart PHP. Check the 'Loaded Configuration File' line in phpinfo() or php --ini, then restart PHP-FPM or the web server.
- "syntax error, unexpected" when PHP parses the file
- A value contains characters such as =, ! or quotes that need quoting, or a line is missing its =. Quote the value and fix the line PHP reports.
- Setting is ignored because it is commented out
- Lines starting with ; are comments, and most default php.ini settings ship commented. Remove the leading semicolon and keep only one active copy of the key.
- Program fails after editing in Notepad
- The editor may have changed the encoding or line endings. Save as UTF-8 without BOM (or the encoding the program expects) and keep the original line endings.
Often converted to or from: JSON, YAML, TOML, .env