heroku php本地环境 - 无效路径

时间:2014-06-30 16:13:32

标签: php heroku nginx composer-php foreman

我安装了composer,它将所有符号链接放在项目的“vendor / bin”目录中。 我没有更改上面创建的任何配置文件。

当我开始领班工作时,我会遇到以下问题:

$ foreman start -f Procfile.dev
17:31:28 web.1  | started with pid 63713
17:31:28 web.1  | Booting on port 5000...
17:31:28 web.1  | DOCUMENT_ROOT changed to '/Users/padawan/Desktop/progetti/gdb/sketchin-heatmap/web'
17:31:28 web.1  | Using PHP-FPM configuration file '/heroku/heroku-buildpack-php/conf/php/php-fpm.conf'
17:31:28 web.1  | Using PHP configuration (php.ini) file '/heroku/heroku-buildpack-php/conf/php/php.ini'
17:31:28 web.1  | Using Nginx server-level configuration include 'nginx_app.conf'
17:31:28 web.1  | Using Nginx configuration file '/heroku/heroku-buildpack-php/conf/nginx/heroku.conf.php'
17:31:28 web.1  | Interpreting /heroku/heroku-buildpack-php/conf/nginx/heroku.conf.php to heroku.conf
17:31:28 web.1  | vendor/bin/heroku-php-nginx: line 17: /Users/padawan/Desktop/progetti/gdb/sketchin-heatmap//heroku/heroku-buildpack-php/conf/nginx/heroku.conf: No such file or directory
17:31:28 web.1  | Starting log redirection...
17:31:28 web.1  | Starting php-fpm...
17:31:28 web.1  | Starting nginx...
17:31:28 web.1  | [30-Jun-2014 17:31:28] ERROR: failed to open configuration file '/Users/padawan/Desktop/progetti/gdb/sketchin-heatmap//heroku/heroku-buildpack-php/conf/php/php-fpm.conf': No such file or directory (2)
17:31:28 web.1  | [30-Jun-2014 17:31:28] ERROR: failed to load configuration file '/Users/padawan/Desktop/progetti/gdb/sketchin-heatmap//heroku/heroku-buildpack-php/conf/php/php-fpm.conf'
17:31:28 web.1  | [30-Jun-2014 17:31:28] ERROR: FPM initialization failed
17:31:30 web.1  | nginx: [alert] could not open error log file: open() "/usr/local/var/log/nginx/error.log" failed (13: Permission denied)
17:31:30 web.1  | 2014/06/30 17:31:30 [emerg] 63764#0: open() "/Users/padawan/Desktop/progetti/gdb/sketchin-heatmap//heroku/heroku-buildpack-php/conf/nginx/heroku.conf" failed (2: No such file or directory) in command line

我无法理解为什么永远不会插入供应商文件夹:例如PHP-FPM配置文件的路径是'/heroku/heroku-buildpack-php/conf/php/php-fpm.conf'而不是真正的' / vendor / heroku / heroku-buildpack- PHP / CONF / PHP / PHP-fpm.conf'

我正在使用这个buildpack:https://github.com/CHH/heroku-buildpack-php

这是我的档案:

// Procfile.dev

web: vendor/bin/heroku-php-nginx -C nginx_app.conf web/

// nginx_app.conf

location / {
# try to serve file directly, fallback to rewrite
try_files $uri @rewriteapp;
}

location @rewriteapp {
    # rewrite all to index.php
    rewrite ^(.*)$ /index.php/$1 last;
}

location ~ ^/(app|app_dev|config)\.php(/|$) {
    fastcgi_pass heroku-fcgi;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS off;
}

// composer.json

{
"name": "sketchin-heatmap",
"require": {
    "php": ">=5.4.0",
    "ext-mongo": "*",
    "silex/silex": "~1.0@dev",
    "twig/twig": ">=1.8,<2.0-dev",
    "symfony/twig-bridge": "~2.3"
},
"require-dev": {
        "heroku/heroku-buildpack-php":"*"
    },
    "extra": {
        "heroku": {
            "document-root": "web",
            "index-document": "index.php"
        }
    }
}

1 个答案:

答案 0 :(得分:0)

您需要全局安装composer。通过运行vendor在启动脚本中确定composer config vendor-dir文件夹。在你的情况下,这似乎失败了。

您的项目中是否只有composer.phar,但路径上没有composer命令? If so, copy composer.phar to e.g. / usr / local / bin / composer `。