cloudControl / buildpack-php

cloudControl PHP buildpack
Apache License 2.0
13 stars 18 forks source link

[custom-buildpack] Missing NewRelic extension when using specific PHP version #36

Closed holtkamp closed 9 years ago

holtkamp commented 9 years ago

An error occurs when using the following composer.json snippet and pushing the changes:

"require": {
        "php-64bit": "5.6.10",
        "ext-newrelic": "*"
    }

The error:

remote: -----> Receiving push
remote: -----> Using php version 5.6.10
remote: 
remote: gzip: stdin: not in gzip format
remote: tar: Child returned status 1
remote: tar: Error is not recoverable: exiting now
remote:  !     cloudControl push rejected, failed to compile custom app
remote:  !
remote: -----> Custom buildpack provided
remote: error: hook declined to update refs/heads/master

Obviously, this causes the application to stop reporting to New Relic.

TooAngel commented 9 years ago

I updated to newrelic packages and include the libraries for php-5.5 and php-5.6. https://github.com/cloudControl/buildpack-php/commit/300b470c83f1f8497c85de53610149fdec7614f1

Tested with: 5.4.39, 5.4.42, 5.5.26 and 5.6.10.

holtkamp commented 9 years ago

NewRelic extension is installed succesfully. However, during the installation an error-message now appears:

remote: -----> Receiving push
remote: -----> Using php version 5.6.10
remote: -----> Installing composer dependencies...
remote: ERROR: no log file specified - cannot continue.

I think this is because the CloudControl image is not yet 'up and running' / assembled completely / the /srv/www/php-5.6.10/etc/conf.d/newrelic.ini file is not parsed by the PHP-CLI. The extension works properly, metrics are sent to NewRelic again, but this error message might confuse users.

TooAngel commented 9 years ago

I can't reproduce the error. I created a new application with cctrlapp APP_NAME create custom --buildpack https://github.com/cloudControl/buildpack-php.git#customphp

composer.json:

{"require": {
  "php-64bit": "5.6.10",
  "ext-newrelic": "*"
}}

push output:

-----> Receiving push
-----> Using php version 5.4.39
-----> Installing composer dependencies...
Loading composer repositories with package information
Installing dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
-----> Building image
-----> Custom buildpack provided
-----> Uploading image (42.6 MB)

Are you using the cloudControl/buildpack-php#customphp already?

holtkamp commented 9 years ago

mmm, it is caused by the combination of ext-newrelic and an additional configuration file at .buildpack/php/conf/newrelic.ini with content:

[NewRelic]
newrelic.framework = "zend"

I should have mentioned an other, comparable, warning is displayed as well, caused by .buildpack/php/conf/browscap.ini with content:

[browscap]
browscap = /app/code/application/resources/ini/php_browscap.ini

This warning is: PHP Warning: Cannot open '/app/code/application/resources/ini/php_browscap.ini' for reading in Unknown on line 0.

When removing these additional configuration files from .buildpack/php/conf, these messages disappear. So I think the extensions are loaded when executing a php-cli command (like composer install), while the paths used in some configuration file are not available yet?

TooAngel commented 9 years ago

Ok, the buildpack files creates already a newrelic.ini, which takes care that or the newrelic warnings within the build process. This is overwritten by your newrelic.ini. I can rename the file within the buildpack to reduce the possibility of collisions.

The second issue is related to the build environment, I need to have a look how to prevent this.

TooAngel commented 9 years ago

I renamed the newrelic.ini file to avoid collisions. https://github.com/cloudControl/buildpack-php/commit/97089fa3ebe242ce35a9b6de85e4f78d7de2c209

And I also made /app/code available within the build, so that your absolute browscap path shouldn't lead to an error anymore.

holtkamp commented 9 years ago

Nice, no more error messages during deploys indeed, :+1: , closing issue.