mojolicious / mojo

:sparkles: Mojolicious - Perl real-time web framework
https://mojolicious.org
Artistic License 2.0
2.66k stars 577 forks source link

Unknown command "cgi", maybe you need to install it? #1860

Open leandrocombr opened 2 years ago

leandrocombr commented 2 years ago

Steps to reproduce the behavior

pp -M Mojolicious::Plugin::* -o test.pl script.pl

Expected behavior

When running the script on the server it gives the following error: Unknown command "cgi", maybe you need to install it?

Actual behavior

LOG: Unknown command "cgi", maybe you need to install it?

Grinnz commented 2 years ago

You normally need to pass a command to the script, whether it's help or get or daemon or something else. It's probably trying to run cgi due to something in your environment.

There's some context important to debugging this that pp is PAR Packer and so this isn't a standard mojolicious deployment.

Grinnz commented 2 years ago

Rereading the problem, did you mean to specify that it is run by a CGI server and that's why it's attempting to run the cgi command?

leandrocombr commented 2 years ago

Rereading the problem, did you mean to specify that it is run by a CGI server and that's why it's attempting to run the cgi command?

I'm running via apache

MartinMcGrath commented 2 years ago

Are you using something like Mojolicious::Plugin::RenderCGI, which has a dependency on CGI? I've used pp a lot in the past but never for Mojolicious apps, and don't think I ever would. Generally speaking running pp with the -x option to determine additional runtime dependencies has worked out well for me. Combined with the logging (-L) and (-v) verbose options you should be able to track down what is going on. Failing that simply unzipping your exe will show you what pp has packed.

jberger commented 2 years ago

It sounds like pp is not including dynamically loaded modules. You might have to tell it to include those specifically