You are unsure why or when you must restart your web server (Apache, PHP-FPM, Nginx, etc.) after:
- Installing or upgrading the PHP agent
- Updating PHP to a major release version
- Changing any agent configuration settings in the
- Utilizing external startup mode for the daemon
The PHP agent is a PHP extension. When your web server starts up and loads PHP, it also loads the PHP agent and parses its
newrelic.ini configuration file. The web server uses that configuration until told to re-load and parse configuration files again. Restarting prompts the web server to do that.
You must restart your web server when:
- You modify your configuration file.
Configuration changes in
newrelic.cfgfiles do not take effect (for example, naming your app, generating logs, changing your license key) until you restart the web server.
- Your package manager auto-updates the agent without restarting the web server.
To avoid this situation, set an exclude for
newrelic-php5*in your package manager.
If your package manager automatically updates the agent, you must restart your web server. Updating the agent without restarting can cause the agent to stop reporting.
This issue occurs when auto-update is enabled and the daemon updates to a new version. The new daemon is then unable to communicate with the agent, which is still running the old version.
To avoid this, the new agent must be started after the update. This process is complicated, because a full agent restart also requires you to restart your web server software.
- The daemon is set to start up in external mode.
- Apache isn't fully restarting with the
apachectl restartcommand does not always fully restart the web server, so it doesn't re-parse the agent's configuration files. New Relic recommends using:
apachectl stop apachectl start