当从我们自己的PHP自定义buildpack移动到支持的Heroku时,我们遇到了一个问题。 Heroku要求我们为composer.json添加某些扩展。"要求"部分,但是当你尝试在本地更新它失败,因为这些包在repo中不存在。
配置文件:
{
"config":{
"github-oauth":{
"github.com":""
}
},
"require": {
"php": "*",
"ext-newrelic": "*",
"ext-memcached": "*",
"aws/aws-sdk-php": "2.*",
"rollbar/rollbar": "*",
"yiisoft/yii": "1.1.15",
"cloudinary/cloudinary_php": "1.0.11",
"geoip/geoip": "v1.14",
"sendgrid/sendgrid": "2.1.1",
"swiftmailer/swiftmailer": "v5.2.1",
"crisu83/yiistrap": "dev-bs3"
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpunit/dbunit": ">=1.2",
"phpunit/php-invoker": "*",
"phpunit/phpunit-selenium": ">=1.2",
"phpunit/phpunit-story": "*",
"squizlabs/php_codesniffer": "1.*",
"phpmd/phpmd" : "1.4.*",
"phploc/phploc": "*",
"pdepend/pdepend" : "1.1.0",
"sebastian/phpcpd": "*",
"mayflower/php-codebrowser": "~1.1"
}
}
错误讯息:
11:08:55 {development} /Volumes/Development/web$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested PHP extension ext-newrelic * is missing from your system.
Problem 2
- The requested PHP extension ext-memcached * is missing from your system.
有什么想法吗?
答案 0 :(得分:1)
安装扩展程序为我修复此问题(newrelic扩展程序给我带来了麻烦,但这是另一个问题。)
(答案在这里发布,但该人再次将其删除。)
答案 1 :(得分:1)
您需要安装这些扩展程序。假设您在开发期间使用与生产中大致相同的组件和环境在本地开发,运行和测试代码,因此如果您在生产中使用memcache,则还可以在本地使用它。这可以确保您不会遇到令人讨厌的意外,因为不同的数据存储行为不同等。另请参阅http://12factor.net/dev-prod-parity
规则的例外情况:您不需要安装New Relic扩展程序;如果您配置New Relic附加组件(通过检测NEW_RELIC_LICENSE_KEY
env var),它会在推送时自动启用,请参阅https://devcenter.heroku.com/articles/php-support#extensions(它在开发人员的盒子上很少使用,并且可能有点麻烦安装)。