---
title: Introduction to New Relic for PHP
source: https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/introduction-new-relic-php
---

Our PHP agent monitors your application to help you [identify and solve performance issues](#monitor-performance). You can also extend the agent's performance monitoring to [collect and analyze business data](#business-data) to help you improve the customer experience and make data-driven business decisions.

Use the New Relic PHP agent to solve your app's performance issues with our [My app is slow tutorial](https://docs.newrelic.com/docs/journey-app-slow/root-causes/).

## Monitor app performance [#monitor-performance]

![PHP - APM Summary](https://docs.newrelic.com/images/apm_screenshot-full_php-summary-page.webp "PHP - APM Summary")

**[one.newrelic.com > All capabilities](https://one.newrelic.com/all-capabilities) > APM & services > (select an app) > Summary**: After installing the PHP agent, view a summary of your app's performance.

**View the big picture of your app**

-   Monitor your app's [Apdex (user satisfaction)](https://docs.newrelic.com/docs/apm/new-relic-apm/apdex/apdex-measuring-user-satisfaction)
-   Get a [high-level summary of your app](https://docs.newrelic.com/docs/apm/applications-menu/monitoring/apm-overview-page)
-   Create [architectural maps](https://docs.newrelic.com/docs/data-analysis/user-interface-functions/view-your-data/service-maps-visualize-monitor-apps-entire-architecture) of your app

**Find errors and problems quickly**

-   Track [key transactions](https://docs.newrelic.com/docs/apm/transactions/key-transactions/key-transactions-tracking-important-transactions-or-events)
-   [Search and create customizable charts](https://docs.newrelic.com/docs/insights/new-relic-insights/explore/metric-explorer-search-chart-metrics-sent-new-relic-agents) for the metric timeslice data most important to you, including any [custom metrics](https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-data/custom-metrics) you are sending to New Relic.
-   [Alert](https://docs.newrelic.com/docs/alerts/alert-policies/understanding-alert-policies/alerting-new-relic) your team when errors or problems occur before they affect your users
-   Track performance [after a deploy](https://docs.newrelic.com/docs/agents/php-agent/features/recording-deployments-using-php-script)

**Drill down into performance details**

-   Examine code-level [transaction traces](https://docs.newrelic.com/docs/apm/transactions/transaction-traces/transaction-traces)
-   Examine [database query traces](https://docs.newrelic.com/docs/apm/transactions/transaction-traces/sql-statements)
-   Examine [error traces](https://docs.newrelic.com/docs/apm/applications-menu/events/viewing-apm-errors-error-traces)

**View logs for your infrastructure data**

Bring your logs and application's data together to make troubleshooting easier and faster. No need to switch to another UI page.

-   With [logs in context](https://docs.newrelic.com/docs/logs/logs-context/configure-logs-context-php/), you can see log messages related to your errors and traces directly in your app's UI.
-   You can also see logs in context of your [infrastructure data](https://docs.newrelic.com/docs/logs/forward-logs/forward-your-logs-using-infrastructure-agent/), such as Kubernetes clusters.

**Analyze business data**

Use the PHP agent to organize, query, and visualize your data to answer key questions about application performance and customer experience.

-   Use [default transaction attributes](https://docs.newrelic.com/docs/insights/new-relic-insights/decorating-events/apm-default-attributes-insights) or [add your own](https://docs.newrelic.com/docs/insights/new-relic-insights/decorating-events/insights-custom-attributes)
-   Query your data [using NRQL](https://docs.newrelic.com/docs/insights/new-relic-insights/using-new-relic-query-language/using-nrql)
-   Send [your own event data](https://docs.newrelic.com/docs/insights/new-relic-insights/adding-querying-data/inserting-custom-events-new-relic-apm-agents#php-att)
-   Create and share customizable, interactive [dashboards](https://docs.newrelic.com/docs/query-your-data/explore-query-data/query-builder/introduction-query-builder)

## Architecture

The PHP agent has two binaries that work together to forward data to New Relic:

-   The agent handles automatic and API instrumentation of your PHP code.
-   The daemon acts as a proxy between the agent and the New Relic platform.

You can connect up to 500 applications/agents to one daemon. The daemon imposes [sampling](https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-data/new-relic-events-limits-sampling) when the harvest cycle limits are reached, so consider this when deciding how many applications/agents to connect to a single daemon.

> #### 💡 TIP
>
> The number of applications/agents per daemon may be lower when running in separate Docker containers, depending on the capacity of the connection between containers.

![This diagram shows the flow of data from the PHP agent to New Relic.](https://docs.newrelic.com/images/apm_diagram_php-agent-diagram.webp "PHP agent diagram")

The flow of data from your PHP applications to New Relic.

The workflow between your application and New Relic must occur in this order:

1.  The agent establishes a socket connection with the daemon by sending the first payload of instrumentation data.
2.  The daemon establishes an HTTPS link with the New Relic platform. The daemon must be invoked before your instrumented application is invoked. This is called [agent mode](https://docs.newrelic.com/docs/agents/php-agent/advanced-installation/starting-php-daemon-advanced) and is the default.

To avoid losing reported data, make sure your instrumented application doesn't send transactions before both connections are established.

## Install the agent [#installation]

Before you install the PHP agent, ensure your system meets the [system requirements](https://docs.newrelic.com/docs/agents/php-agent/getting-started/php-agent-compatibility-requirements). The PHP agent supports many of the most common [PHP frameworks](https://docs.newrelic.com/docs/agents/php-agent/getting-started/php-agent-compatibility-requirements#frameworks), [databases](https://docs.newrelic.com/docs/agents/php-agent/getting-started/php-agent-compatibility-requirements#databases), and [libraries](https://docs.newrelic.com/docs/agents/php-agent/getting-started/php-agent-compatibility-requirements#databases). You can also use the agent in a [Google App Engine (GAE) flexible environment](https://docs.newrelic.com/docs/agents/php-agent/advanced-installation/install-new-relic-php-agent-gae-flexible-environment).

> #### 💡 TIP
>
> If you are [installing the agent on a shared hosting service](https://docs.newrelic.com/docs/agents/php-agent/installation/install-php-agent-shared-hosting-service), ensure you have root permissions to install the agent or contact your hosting provider for technical assistance.

To install the agent, [sign up for New Relic](https://newrelic.com/signup) first. Once logged in, use our launcher, or see the instructions for specific installations.

[Add PHP data](https://one.newrelic.com/marketplace/install-data-source?state=d1b7b1cb-4089-8af0-16b2-86c7072e2cae)

For **standard installations**, see:

-   [PHP agent installation overview](https://docs.newrelic.com/docs/agents/php-agent/installation/php-agent-installation-overview) (the basic installation steps for the most common setups).
-   [Installing on RedHat or CentOS](https://docs.newrelic.com/docs/agents/php-agent/installation/php-agent-installation-redhat-and-centos)
-   [Installing on Ubuntu or Debian](https://docs.newrelic.com/docs/agents/php-agent/installation/php-agent-installation-ubuntu-and-debian)
-   [Installing with tar archive](https://docs.newrelic.com/docs/agents/php-agent/installation/php-agent-installation-tar-file) (generic method to use on any supported systems such as Linux variants, OpenSolaris, SmartOS, FreeBSD, macOS, etc)
-   [The newrelic-install script](https://docs.newrelic.com/docs/agents/php-agent/installation/newrelic-install-script) (how to use the interactive script that automates some installation tasks)

For other types of PHP installations and **advanced installation** topics, see:

-   [PHP agent installation: Non-standard PHP](https://docs.newrelic.com/docs/agents/php-agent/installation/php-agent-installation-non-standard-php)
-   [Starting the PHP daemon](https://docs.newrelic.com/docs/agents/php-agent/installation/starting-php-daemon-advanced) (a standard New Relic installation starts the daemon automatically, but you can also [start the daemon manually](https://docs.newrelic.com/docs/agents/php-agent/installation/starting-php-daemon-advanced#selecting-external))
-   [Silent mode for the install script](https://docs.newrelic.com/docs/agents/php-agent/installation/running-php-install-script-silent-mode)
-   [Google App Engine (GAE) flex environment installation](https://docs.newrelic.com/docs/agents/php-agent/advanced-installation/install-new-relic-php-agent-gae-flexible-environment) for New Relic's PHP agent

## Configure the agent [#configuration]

The agent includes a variety of [configuration options](https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-configuration) to further customize and fine-tune your installation.

> #### 💡 TIP
>
> The most important part of agent configuration is to give your app a [descriptive name](https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-configuration#inivar-appname). New Relic [uses this app name to aggregate metrics](https://docs.newrelic.com/docs/agents/manage-apm-agents/app-naming/name-your-application#app-name) when you have multiple apps or hosts.

After changing any agent configuration options, restart your web server.

## Extend agent instrumentation [#extend]

After installing the agent, go further and extend the agent's instrumentation:

-   [Page load timing](https://docs.newrelic.com/docs/agents/php-agent/features/page-load-timing-php): Integrate the PHP agent with [browser monitoring](https://docs.newrelic.com/docs/browser/new-relic-browser/getting-started/new-relic-browser) to gain visibility into end-user activity.
-   [Custom instrumentation](https://docs.newrelic.com/docs/agents/php-agent/features/php-custom-instrumentation): Instrument transactions not captured as part of our framework instrumentation.
-   [Agent API](https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-api): Use the agent API to customize the agent's behavior. For example, you can collect custom metrics, flag an error, or ignore a particular transaction entirely.
-   [Agent attributes](https://docs.newrelic.com/docs/agents/php-agent/attributes/php-agent-attributes): Customize the [attributes](https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-metrics/agent-attributes) attached to transactions. Customizing attributes allows you to avoid sending sensitive attributes, or to collect additional attributes for deeper visibility into your transactions.

## Troubleshoot your installation [#troubleshoot]

If you're having problems, see the PHP agent troubleshooting docs. Some of the most important troubleshooting docs in that section include:

-   [No data appears (PHP)](https://docs.newrelic.com/docs/agents/php-agent/troubleshooting/no-data-appears-php)
-   [Determining permissions requirements](https://docs.newrelic.com/docs/agents/php-agent/troubleshooting/determining-permissions-requirements)
-   [INI settings not taking effect immediately](https://docs.newrelic.com/docs/agents/php-agent/troubleshooting/ini-settings-not-taking-effect-immediately)
-   [Why and when to restart your web server (PHP)](https://docs.newrelic.com/docs/agents/php-agent/troubleshooting/why-when-restart-your-web-server-php)
