Platform.sh User Documentation

PHP

Try for 30 days
Flexible, version-controlled infrastructure provisioning and development-to-production workflows
Activate your trial

Get your license key Anchor to this heading

Sign up at New Relic to get your license key.

Add your license key Anchor to this heading

Add your New Relic license key as an environment level variable:

platform variable:create --level environment --environment ENVIRONMENT_NAME --visible-build false --inheritable false --json false --sensitive true --enabled true --visible-runtime true php:newrelic.license --value NEW_RELIC_LICENSE_KEY

Give your application a name Anchor to this heading

Add a new environment level variable to give your application a recognizable name:

platform variable:create --level environment --environment ENVIRONMENT_NAME --visible-build false --inheritable false --json false --sensitive true --enabled true --visible-runtime true php:newrelic.appname --value APP_NAME

Enable the New Relic extension Anchor to this heading

Enable the New Relic extension in your .platform.app.yaml as follows:

runtime:
    extensions:
        - newrelic

Push the changes to your Platform.sh environment to enable New Relic as follows:

git add .platform.app.yaml
git commit -m "Enable New Relic."
git push

That’s it! You need to wait a little bit for your New Relic dashboard to be generated.

Configure New Relic to your needs Anchor to this heading

New Relic agent can be configured through PHP variables.

For instance, to disable the tracing and reduce the amount of data sent, set the distributed_tracing_enabled variable to false :

platform variable:create --level environment --environment ENVIRONMENT_NAME --visible-build false --inheritable false --json false --sensitive false --enabled true --visible-runtime true php:newrelic.distributed_tracing_enabled --value false

Troubleshoot Anchor to this heading

Additionally, you can check that your application is properly connected to New Relic by looking at the /var/log/app.log file:

platform log app

2017/04/19 14:00:16.706450 (93) Info: Reporting to: https://rpm.newrelic.com/accounts/xxx/applications/xxx
2017/04/19 14:00:16.706668 (93) Info: app 'xxx-main-xxx.app' connected with run id 'xxx'

Is this page helpful?