2

I'm trying use Nginx + Phalcon. So I have the root folder (app) and my public folder (app/public).

Inside the root (app) I have the Procfile:

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

And inside my public folder I have my index.php

<?php exit('hello');

With this simple example, shouldn't print hello when I access the url myapp.herokuapp.com?

If my thought is right, which is not working. My second problem is that the nginx_app.conf seems that are not been reading by the server. Because every f* page that I tried access I got 404.

So, what am I doing wrong?

[UPDATED]

Here's the log:

heroku[web.1]: State changed from down to starting
heroku[web.1]: Starting process with command `php -S 0.0.0.0:57262`
heroku[web.1]: State changed from starting to up
app[web.1]: [Tue Apr  7 11:08:07 2015] 10.185.81.31:28258 Invalid request (Unexpected EOF)
app[web.1]: [Tue Apr  7 11:08:07 2015] 172.19.28.141:33686 Invalid request (Unexpected EOF)
heroku[router]: at=info method=GET path="/" host=myapp.herokuapp.com request_id=d39f119a-fd95-4887-809f-74712925606f fwd="200.221.158.131" dyno=web.1 connect=2ms service=4ms status=404 bytes=668
app[web.1]: [Tue Apr  7 11:08:44 2015] 10.61.196.230:38679 [404]: / - No such file or directory

[UPDATED]

$ git push ...
[...]
remote: -----> Discovering process types
remote:        Procfile declares types -> web

$ heroku run bash
$ cat Procfile
~ $ : vendor/bin/heroku-php-nginx public/~ $

And according the documentation should be

heroku run bash
Running `bash` attached to terminal... up, run.5662
$ cat Procfile
web: vendor/bin/heroku-php-apache2

A little detail that I have tried:

cat Procfile
~ $ vendor/bin/heroku-php-nginx public/c/~ $
vendor/bin/heroku-php-nginx public/
DOCUMENT_ROOT changed to 'public/'
Optimzing defaults for 1X dyno...
4 processes at 128MB memory limit.
Starting php-fpm...
Starting nginx...

I'm waiting... let's see what happens

Pablo
  • 1,953
  • 4
  • 28
  • 57

1 Answers1

4

Something is wrong with your Procfile; as you can see, Heroku is booting in the default php -S mode. This happens when a Procfile is present, but no "web" process type is declared; this should also be written out in a message towards the very end of a git push heroku master (something about the Procfile not declaring a "web" process type and it then using a default).

That rules out your Procfile not being checked into Git or having the wrong name (e.g. lowercase procfile).

The culprit is very, very likely a Unicode Byte Order Mark that the editor you're using is inserting at the beginning of the file: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8

So your Procfile doesn't look like this:

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

but actually like this:

\0xEF\0xBB\0xBFweb: vendor/bin/heroku-php-nginx -C nginx_app.conf public/

Your editor (and most editors for that matter) simply don't display the BOM.

To fix the issue, save your Procfile without a BOM (and, while your at it, configure your editor to never save a UTF-8 BOM, because its use is highly discouraged and causes myriads of problems just like this one).

dzuelke
  • 2,645
  • 15
  • 16
  • I agree that's something wrong with my Procfile, but look at my next update above. – Pablo Apr 07 '15 at 19:13
  • Just to close this issue, first that was a nice idea. My file wasn't a BOM but was a UTF8 and at this point I'm not sure if that was the problem, but I change to ANSI. Second I also executed the Procfile line on bash. So this two things have worked for me. Thank you guys for all. – Pablo Apr 08 '15 at 15:40
  • So now it works fine? Does `cat Procfile` in the dyno now show the correct contents, with "web:" at the front? If so, then maybe this indeed was some problem with your system/Git/editor... – dzuelke Apr 09 '15 at 23:22
  • Actually I didn't check the cat Procfile, but I'll. I'm using notepad++ and I have never had this kind of problem, I really don't know what happened. – Pablo Apr 10 '15 at 17:35