Keep internal errors out of public responses

Production PHP should not display detailed errors to public visitors. Send useful diagnostics to protected logs and avoid logging passwords, session values or private request bodies.

Set the production environment through the hosting or application configuration. Check that per-directory settings cannot turn debug output back on.

Review uploads and sessions

Set request and upload limits that match the site’s real needs. Store uploaded files away from executable application code and enforce access checks on downloads.

Use secure session cookie settings and rotate session identifiers after sign-in. Keep session storage protected and remove old session data on a defined schedule.

Apply settings in the correct place

PHP can run through different handlers and pools. Confirm which configuration file applies to the web request, command-line job and worker.

After a change, inspect the active settings and test the application. Ask the hosting provider to confirm managed settings that are outside your account’s control.