简体   繁体   English

将具有扩展名mongo的PHP应用程序部署到heroku 2015中

[英]Deploy PHP application with extension mongo into heroku 2015

I've just deployed php application into heroku with extension mongo db. 我刚刚将PHP应用程序部署到具有扩展mongo db的heroku中。 In previous (11/2014), it's ok. 在上一个(11/2014)中,可以。 But currently I received error messsage: The requested php extension ext-mongo * is missing from your system. 但目前我收到了错误消息:您的系统中缺少所请求的php扩展名ext-mongo *。

Here is the structure of project on github (using to deploy into heroku): 这是github上项目的结构(用于部署到heroku中):

Root
php.ini
composer.json
composer.lock
Procfile
MySources
ext 
   mongo.so (this file is located inside ext folder).

php.ini: php.ini中:

extension_dir="/app/ext/"
extension=mongo.so

composer.json: composer.json:

{
  "require" : {
    "silex/silex": "~1.1",
    "monolog/monolog": "~1.7",
    "ext-mongo": "*"
  },
  "require-dev": {
    "heroku/heroku-buildpack-php": "*"
  }
}

Procfile: Procfile:

web: vendor/bin/heroku-php-apache2

Any one can help me to configure or sugguest me to resolve this problem? 任何人都可以帮助我配置或建议我解决此问题吗? Deploy with the lasted heroku and php 5.6.7. 使用持久的heroku和php 5.6.7进行部署。

You don't need the ext folder (because the extension is already available on Heroku), and you don't need the php.ini , which doesn't have any effect anyway, because you're not configuring Heroku to use it. 您不需要ext文件夹(因为该扩展名已经在Heroku上可用了),并且您不需要php.ini ,无论如何它没有任何作用,因为您没有配置Heroku使用它。

You need to run composer update so the ext-mongo requirement gets "frozen" to composer.lock . 您需要运行composer update以使ext-mongo要求“冻结”到composer.lock

If you don't have that extension installed locally on your system, then you should install it (along with a MongoDB server), because you really want to test your code locally before you blindly push it up to Heroku to see whether it works or not. 如果您的系统上没有本地安装该扩展,则应该安装它(与MongoDB服务器一起),因为您真的想在本地测试您的代码,然后再盲目地将其推到Heroku上以查看其是否有效。不。

If, for any reason, you can't do that, a composer update --ignore-platform-reqs will prevent "The requested php extension ext-mongo * is missing from your system" to happen on your local machine, and generate the correct composer.lock even if the extension is missing. 如果由于某种原因您无法执行此操作,则composer update --ignore-platform-reqs将阻止在您的本地计算机上发生“系统中缺少所请求的php扩展名ext-mongo *”,并生成即使扩展名丢失,也可以纠正composer.lock

This is, by the way, all clearly documented here: https://devcenter.heroku.com/articles/php-support#extensions 顺便说一下,这一切都清楚地记录在这里: https : //devcenter.heroku.com/articles/php-support#extensions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM