Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Deploying Catalyst App On Shared Server

by varanasi (Scribe)
on Aug 27, 2017 at 13:09 UTC ( [id://1198098]=perlquestion: print w/replies, xml ) Need Help??

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

Dear Monks:

I need help deploying a catalyst app on a shared host. I have tried the methods written up at:

  1. Catalyst::Manual::Deployment::SharedHosting
  2. http://blog.johngoulah.com/2009/08/deploying-catalyst-shared-hosting/
  3. http://forums.hostgator.com/catalyst-framework-hostgator-shared-hosting-t68761.html

The host runs apache and has Mod FastCGI installed. (EDIT: It's actually mod_fcgid.) Apache has ExecCGI and FollowSymLinks enabled. It does not have modRuid enabled.

The closest I have gotten is following the instructions in the first link -- the Catalyst Manual. (I had to change ln -s ~/lib/MyApp/script script to ln -s ~/MyApp/script script). As suggested, I put a .htaccess file into public_html. Here's what it looks like, ~/public_html/.htaccess:

RewriteEngine On RewriteCond %{REQUEST_URI} !^/?script/myapp_fastcgi.pl RewriteRule ^(.*)$ script/myapp_fastcgi.pl/$1 [PT,L]

With this config, when I go to mydomain.com, I get a server error. The log shows that myapp_fastcgi.pl starts, loads the app, but breaks with this message:

AH01215: STDIN is not a socket: specify a listen location at /usr/loca +l/share/perl5/Plack/Handler/FCGI.pm line 57.: /home/mydomain/public_h +tml/script/myapp_fastcgi.pl

The only lead I have is that adding AddHandler fcgid-script .pl to ~/public_html/.htaccess results in a not found error, The requested URL /script/myapp_fastcgi.pl/ was not found on this server. I don't know whether that's actually a lead or not. The app loads fine on the server; there are no missing modules, etc.

I'm completely stumped. I have asked on #catalyst several times but without success. I would very, very grateful for any help.

Replies are listed 'Best First'.
Re: Deploying Catalyst App On Shared Server
by beech (Parson) on Aug 27, 2017 at 19:48 UTC

      Thanks for the ideas.

      I used tildes in the ln command to create the link -- the links works fine and contains the complete path. In the .htaccess file, there are no tildes.

      I don't think there is a FastCgiIpcDir set. (The server has mod_fastcgi rather than mod_fcgid installed so the parameter name is slightly different. See https://docs.oracle.com/cd/B31017_01/web.1013/q20204/mod_fastcgi.html#FastCgiIpcDir) I don't see anything like that in the httpd.conf file. I can try to set one, but I don't know which directory I would set it to. (The examples I've seen use /tmp/fcgi but that means nothing to me.) Suggestions welcome!

        Hi,

        The server has mod_fastcgi rather than mod_fcgid installed so the parameter name is slightly different.

        You mentioned "fcgid-script" , but mod_fastcgi docs only mentions "fastcgi-script", so if you're sure you have mod_fastcgi, try "fastcgi-script" as the handler.

        I don't think there is a FastCgiIpcDir set. The examples I've seen use /tmp/fcgi but that means nothing to me.)

        If it still doesn't work, create "~/FastCgiIpcDir" and point to it in .htaccess and see what happens

Re: Deploying Catalyst App On Shared Server
by zakame (Pilgrim) on Aug 28, 2017 at 04:46 UTC
    The closest I have gotten is following the instructions in the first link -- the Catalyst Manual.

    Did you heed this part:

    (assuming the server is setup to handle .pl as fcgi - you may need to rename the script to myapp_fastcgi.fcgi and/or use a SetHandler directive).

    I might be wrong, but just in case do check that your server does handle .pl as .fcgi, and not accidentally handling .pl as would be in a plain cgi-bin (or rename/symlink your scripts like so.) Otherwise, you probably need to escalate to your server provider to enable handling .pl as .fcgi for your virtualhost, among others.

      Thanks for looking at this so carefully. I should have mentioned in my original post that I did indeed try the suggestion in the docs of renaming the script and made matching changes to the .htaccess file.

      I'm not sure how to tell whether the server is handling a script as cgi or fast_cgi. Is there a way to determine this? (I thought adding an AddHandler in the .htaccess file forced this, but that's merely an assumption I made looking at the material at the links above.)

Re: Deploying Catalyst App On Shared Server
by Anonymous Monk on Aug 28, 2017 at 02:21 UTC
    Look carefully at reply #2 to your third link – for HostGator. It is not enough to simply use a rewrite-rule: your script must be a HANDLER that is invoked by Apache (FastCGI), that runs persistently, and that gets requests handed to it. What you see right now is an attempt to invoke it as though it were a CGI script: of course it cannot find a FastCGI environment to connect to. I do not think that you can accomplish your aim with htaccess files alone. The reply I mentioned refers to a VirtualHost entry.

      Thank you.

      I understand what you are saying about the script being invoked as a CGI script. I also understand that the AddHandler in the .htaccess file may not be enough to change that. (I tried adding AddHandler fastcgi-script .pl to the .htaccess file per beech's suggestion. That results in a 404 error -- same as with AddHandler fcgid-script .pl. EDIT: Same result using cpanel to set either of those as a user-specific handler.)

      I'm afraid I don't see a mention of a VirtualHost entry in HostGator reply #2, but I think I understand in very general terms what one is. If I'm going to change the server itself, even by changing the vhost file for my domain, I'm either going to have to change it myself through cpanel -- and I don't see a way to do that -- or tell them exactly what I want them to do. I'll need to research virtual host files I guess, unless someone here knows . . . . Please let someone here know!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-23 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found