Pm2: PHP-FPM fails on script configuration

Created on 5 Jan 2017  路  8Comments  路  Source: Unitech/pm2

I am trying to run php-fpm via pm2 and failing miserably.
I'm configuring pm2 via process file (json).

php-fpm does not expect to be provided a script to run but just want to start the php-fpm process.
Scripts etc are managed via, in my case, the nginx conf.

pm2 does not seem to provide an option to give an empty "script" so I can't start php-fpm via pm2.
Instead, i get the php-fpm usage output in my application logs which is not what I would expect.

It would be great if it was either allowed to provide an empty "script" attribute or a dummy value like "interpreter": "none", which is allowed.

The solution could look something like:
I provide "script": "none", pm2 just starts the interpreter with what ever interpreter_args I have provided, no complaints.

Low Pending Release API Enhancement

All 8 comments

You can customize the interpreter and interpreterArgs and set it to your php-fpm binary, exactly what you said in your solution so i don't get what's the problem here exactly ?

pm2 requires a value in the script attribute or it will fail.
php-fpm fails if a script is provided.
catch-22 unless there is some way to work around this?

just let script empty ?

If script is empty pm2 fails.

From lib/Common.js:84:

    if (!app.script)
        return new Error('No script path - aborting');

I'm not sure what side-effects changing that if statement would have but I suspect there would be a few.

I guess we can allow a hardcoded none value without side-effects

PS : If you can make a quick PR for the master branch it would be really cool !

I'll see about the PR tomorrow :)

You could do:

{
  "apps" : {
      "script" : "php-fpm"
  }
}

Working with the sample of Unitech, we published with v2.3.0 a alias, like this you can do :

{
  "apps" : {
      "exec" : "php-fpm"
  }
}
Was this page helpful?
0 / 5 - 0 ratings