Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Plack beer challenge

by morgon (Priest)
on Sep 28, 2011 at 19:30 UTC ( [id://928402]=perlquestion: print w/replies, xml ) Need Help??

morgon has asked for the wisdom of the Perl Monks concerning the following question:

Hi

after having just wasted another train journey I have had it now.

Evidently (as I keep reading how "everything just works") I need some external input, so I am offering a bait I know you cannot refuse, the one true currency among Perl-hackers:

BEER

I hope this extraordinary measure conveys how desperate I have become...

So here is the challenge:

I want a complete working solution to make a plack-app run as fast-cgi under apache on Linux.

You can use either mod_fastcgi or mod_fcgid but I want a full apache-config, where to put my psgi-file, what to put in the shebang-line etc etc.

Here is the app:

use strict; return sub { return [ 200, ["Content-Type" => "text/plain"], ["hi"] ]; }
I am willing to pay the first monk to supply a working solution a large beer at next year's YAPC::Europe.

If you cannot attend the conference I am willing to send a picture of a real bavarian beer to any email-address of the winner's choosing.

Good luck!

Replies are listed 'Best First'.
Re: Plack beer challenge
by Anonymous Monk on Sep 28, 2011 at 21:15 UTC
      Ok.

      This is exactly the type of answer I was NOT looking for.

      While I believe that your links may contain the answer I have already proven to myself beyond any doubt that I am too stupid to properly understand them...

      Here is my app:

      #!/home/mh/perl514/bin/plackup -s FCGI --listen /tmp/fcgi.sock --daemo +nize --nproc 10 use strict; use warnings; return sub { return [ 200, ["Content-Type" => "text/plain"], ["hi"] ]; }
      Started on it's own it actually works - it starts a web-server on port 5000 that delivers the proper result.

      But how to make this work in Apache?

      I have put this app as "app.psgi" in /usr/lib/cgi-bin and this is my apache-config:

      ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all AddHandler fcgid-script .psgi </Directory>
      Now what happens is that when I try point my browser to the plack-app apache I get an internal server error.

      The plack-app actually is launched (there is a process visible), but it seems to me that the plack-app and apache cannot communicate as I can see in the error log that fcgid reports a read timeout and the really weird thing is that I have this line in the error log HTTP::Server::PSGI: Accepting connections at http://0:5000

      So to me it seems as if Plack is not aware that it runs under apache for some reasons...

      The beer is still for grabs...

        #!/home/mh­/perl514/b­in/plackup -s FCGI --listen /tmp/fcgi.­sock --da +emoniz­e --nproc 10

        When the kernel honors a #! line, it only handles up to 1 argument. It certainly isn't portable to put so many options on your #! unless some non-standard method (not the Unix kernel) is doing the exec.

        - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://928402]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-19 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found