2

I'm trying to revamp some nasty old sites on a cheap shared host using one of these new-fangled Perl web frameworks (Dancer). I had module dependency problems with the existing Perl install (5.6.1) so I built a new (5.12) version locally.

The new Perl version seems to work fine when testing my app or using the development server, and I was hoping I could just change the shebang the CGI script to point to my new Perl and Apache would serve it ok. Unfortunately in the Apache error log I just get:

failed to open log file
fopen: Permission denied
[Thu Dec  9 14:45:21 2010] [error] [client 138.***.***.***] Premature end of script headers: /home/www/hosts/blahblah/cgi-bin/bb/public/dispatch.cgi

This seems to indicate Apache can't find or execute my new Perl version, but I can't see why not.

I've checked the permissions on my local Perl and they're all 755, which I though user www would be able to access and execute ok. Now I've run out of ideas? Is there anything else I can try?

I can SSH in to the hosting server but don't have root perms or access to the Apache config.

Thanks.

2

Not sure I should "answer" this myself but I eventually figured it out the problem. I'd installed my own version of Perl in a ~/perl5 directory, but Apache could apparently only see inside ~/www (a symlink pointing to my domain name.) Rebuilding Perl and all the modules inside ~/www/perl5 fixed things.

Lessons learned:

  • if I'd configured Perl with "relative @INC paths" option enabled I could have just moved the whole lot and saved myself a bunch of time - it's not the default though.
  • cpanm (App::cpanminus on CPAN) is a real time-saver for installing Perl modules and their dependencies if you're in a restricted environment and can't get regular CPAN to work.

Unlikely this'll help someone in a similar situation but you never know.

(Incidentally, now I've solved the build/run problems, running a modern framework like Dancer doesn't seem to be working out with regular old CGI. There might be some config issues remaining but it seems incredibly slow to serve my tiny app. But those are problems for a different SF question.)

  • I'm about 7 years late, but for what it's worth... Dancer runs on PSGI/Plack. It loads Moo (and other things) that have quite a bit of startup. The idea is that it runs in a persistent process. It can interface via Plack to be run as CGI, but that's a real resource-hog. If you want to stick with your Apache, use an FCGI handler and plackup or server_starter. – simbabque Jun 21 '17 at 20:35
  • However, I came here for the CGI specifically. Thanks for the advice. – simbabque Jun 21 '17 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.