2

We've created an app that is running on an Elastic Beanstalk instance, 64 bit PHP version 5.4 (so not legacy). I've used the New Relic installation instructions to install New Relic, and viewing phpinfo shows that New Relic is installed.

However, I'm not getting any data in New Relic and that is because it is saying that the licence is ***invalid format*** under newrelic.licence

I'm getting the licence from my New Relic account, and it is a 40 character hexadecimal string. Here is the current newrelic.config file in the .ebextensions folder I'm using, with most of the licence key commented out.

  packages:
    yum:
      newrelic-php5: []
    rpm:
      newrelic: http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm
    commands:
      configure_new_relic:
        command: newrelic-install install
        env:
          NR_INSTALL_SILENT: true
          NR_INSTALL_KEY: ec9a4...

Skitch of relevant phpinfo

Can anyone shed some light on what's going on here? I've tried two different New Relic licence keys with the same error, I've also surrounded it with a single quote mark and tried uppercase only. And at this point I'm out of ideas on what to try. We're not AWS gurus so it could very easily be something simple like not opening a port to allow the licence to be validated?

  • So, it turns out that New Relic's documentation is wrong, but their blog post is right. Use their blogpost, Easy AWS scalability with PHP and Linux Server Monitor Agents to set it up and get it working. I've asked them to update their documentation, as newbies like myself tend to blindly follow code examples. – BenFreke Dec 2 '13 at 22:59
1

I ran into the same issue. Their documentation seems incomplete. A solution is to add this section to your .ebextensions/newrelic.config config file. When you deploy to Beanstalk, this will create a new ini file with your license key that PHP will parse and pick up.

files:
  "/etc/php.d/newrelic.ini":
    mode: "000777"
    owner: ec2-user
    group: ec2-user
    content: |
      newrelic.license="YOUR-NEW-RELIC-LICENSE-KEY-HERE"
  • This wasn't the final solution, but it's very close. I ended up editing the newrelic.ini file manually with the licence, rather than using the package information. I'm sure with a bit of tweaking I could use this command to create a file with all the info I needed, along with the packages: command. – BenFreke Nov 29 '13 at 3:57
0

You need to edit the file located at: etc/php5/apache2/conf.d/newrelic.ini. Edit the license key field there and restart the deamon and apache.

  • No good. Beanstalk uses httpd, not apache2. Also if he's using AWS Beanstalk then editing local ini files isn't really a solution. – afessler Nov 18 '13 at 21:35
0

The above by @afessler helped a lot. But this wasn't enough, as my install required the following to work. For me, the old newrelic.ini that was initially installed had additional info that needed to be in the file. Please remember, if you've been running a few deploys already, you should delete the old newrelic.ini, as this didn't overwrite for me when doing a deploy.

To check, you should also add a phpinfo.php to your application root to check if New Relic actually installed.

I'll post my entire .config file:

packages:
    yum:
        newrelic-php5: []
        newrelic-sysmond: []
    rpm:
        newrelic: http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm
    commands:
        "01":
            command: newrelic-install install
            env:
                NR_INSTALL_SILENT: true
                NR_INSTALL_KEY: [ENTER_LICENSE_KEY]
        "02":
            command: echo newrelic.appname="[ENTER_APP_NAME]" >> /etc/php.ini
        "03":
            command: nrsysmond-config –set license_key=[ENTER_LICENSE_KEY]
        "04":
            command: /etc/init.d/newrelic-sysmond start

    files:
        "/etc/php.d/newrelic.ini":
            mode: "000777"
            owner: ec2-user
            group: ec2-user
            content: |
                extension = "newrelic.so"
                [newrelic]
                newrelic.license = "[ENTER_LICENSE_KEY]"
                newrelic.logfile = "/var/log/newrelic/php_agent.log"
                newrelic.appname = "[ENTER_APP_NAME]"
                newrelic.daemon.logfile = "/var/log/newrelic/newrelic-daemon.log"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.