checkphpini
Scan every php.ini on the server for startup errors and delete the line that causes each one
- Command:
/go/checkphpini - Category: PHP
- Required option: None
- Output: The PHP error, then
Line <n> has been removed. - Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
A syntax error in a php.ini file makes PHP print a startup error, and it can stop PHP-FPM or Apache from starting. This can happen after a bad edit or a failed change to a setting. /go/checkphpini looks for these errors in the php.ini of every installed PHP version and deletes the line that PHP reports.
[!WARNING] The command edits files in place and keeps no copy of the deleted line. Back up your PHP configuration before you run it. See Safety.
Quick start
/go/checkphpini
Syntax
/go/checkphpini
The command takes no options or arguments. Run it as root. It needs the PHP command line program (php).
Options
None. Any arguments you pass are ignored.
Files checked
| System | php.ini locations |
|---|---|
| AlmaLinux, Rocky, CentOS, Red Hat, Fedora | /etc/php.ini and /etc/opt/remi/<version>/php.ini for each installed PHP version |
| Debian, Ubuntu | /etc/php/<version>/fpm/php.ini, /etc/php/<version>/cli/php.ini, and /etc/php/<version>/apache2/php.ini for each installed PHP version |
On any other system, the command does nothing.
Output
The command prints nothing when no php.ini has an error. When it finds one, it prints the error message that PHP reports and then a confirmation:
PHP: syntax error, unexpected '=' in /etc/php/8.3/fpm/php.ini on line 45
Line 45 has been removed.
The deleted text is not printed. The error message names the file and the line number, so you can see where the change was made.
Each run also adds a line to /var/log/go/checkphpini.log.
Examples
# Back up the PHP configuration first (Debian/Ubuntu)
cp -a /etc/php /root/php-backup
# Scan and repair
/go/checkphpini
# Look for errors yourself without changing anything
php -c /etc/php/8.3/fpm/php.ini -i 2>&1 | grep " on line "
# Restart PHP-FPM so the change is used
/go/fpm
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Nothing is printed, but PHP still shows an error | The error is not in a php.ini that was checked, or it has no file and line number. |
Run the php -c ... -i command from the Examples and read the message. |
Line 0 has been removed. but the error stays |
The error is reported as in Unknown on line 0, as for an extension that cannot be loaded. The command has no file to edit and removes nothing. |
Fix the extension with extension. |
Line <n> has been removed. but the line is still there |
The path of the file in the error has a hyphen, underscore, or capital letter, such as /etc/php/8.3/cli/conf.d/20-curl.ini. The command cannot read this path. |
Edit the file by hand. |
| The command fails when a file has several errors | It handles one error per file. | Fix the errors by hand, or run it again after fixing the first one. |
| A working setting disappeared | The reported line was valid, and the real mistake was on an earlier line, such as a missing quote. | Restore the file from your backup. |
| PHP still uses the old settings | PHP-FPM or Apache was not restarted. | Run fpm or reload. |
Details
What it does, in order
- Logs the run to
/var/log/go/checkphpini.log. - Builds the list of folders to check for the operating system (see Files checked).
- For each folder that has a
php.ini, runs the defaultphpcommand with that file and looks for the texton linein its output. - If an error is found, reads the line number and the file name from it, prints the error, and deletes that line from the file.
The command does not restart PHP-FPM or Apache.
Safety
[!WARNING]
- The line is deleted with no backup, and it is not shown. A line that PHP complains about can be the result of an earlier mistake, so a valid setting may be removed.
- The file named in the error is changed, which can be an extra
.inifile and not thephp.inithat was being checked.
Known issues
- Only errors that name a file whose full path has lowercase letters, digits, dots, and slashes are handled.
- Several errors in one run can make the command fail, while it still prints that the line was removed.
- Errors reported as
in Unknown on line 0are not fixed, but the command still printsLine 0 has been removed. - The default
phpprogram is used to check every file, not the PHP version that the file belongs to.
See also
| Command | Description |
|---|---|
fpm |
Restart all installed PHP-FPM versions on your server |
extension |
List, install, or remove PHP extensions across every version |
displaystartuperrors |
Toggle PHP display_startup_errors across all php.ini files |
memorylimit |
Change the PHP memory limit for all PHP versions |
listphp |
List the available PHP versions on a GoAdmio server |
reload |
Reload PHP-FPM and the active web server |