Check reference

PHP settings

What it checks

Checks display_errors, expose_php, allow_url_include, allow_url_fopen and similar settings.

Check ID: php.ini

The php.ini values that apply to the web server are checked. As with the PHP version, a scan on WP-CLI uses the values recorded during web requests.

SettingReported when
display_errorsOn
expose_phpOn
allow_url_includeOn
allow_url_fopenOn
log_errorsOff
session.cookie_httponlyOff

What a finding means

The titles, severities and explanations below are the ones shown on the Findings screen.

FindingSeverityMeaning
display_errors is on
ini.display_errors
HighPHP errors are shown to visitors. Error messages reveal file paths and code structure.
expose_php is on
ini.expose_php
LowThe PHP version is sent in the X-Powered-By header, which helps attackers pick exploits.
allow_url_include is on
ini.allow_url_include
Criticalinclude/require can load code from remote URLs, which turns file inclusion bugs into remote code execution.
allow_url_fopen is on
ini.allow_url_fopen
LowFile functions can open remote URLs. WordPress does not need this (it uses the HTTP API), but some code may rely on it.
log_errors is off
ini.log_errors
LowPHP errors are not logged, so problems and attacks may go unnoticed.
session.cookie_httponly is off
ini.session.cookie_httponly
InfoPHP session cookies can be read by JavaScript. WordPress itself does not use PHP sessions, but other code may.

How to fix

The recommended action shown with each finding:

  • display_errors is on
    Set display_errors = Off and log errors instead (log_errors = On).
  • expose_php is on
    Set expose_php = Off in php.ini (or the hosting control panel).
  • allow_url_include is on
    Set allow_url_include = Off.
  • allow_url_fopen is on
    Turn it off if no code on the site depends on it.
  • log_errors is off
    Set log_errors = On and make sure the log is not publicly accessible.
  • session.cookie_httponly is off
    Set session.cookie_httponly = On.

Related settings

  • Settings → Checks → Enabled checks: switch “PHP settings” on or off.