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

Hello all!

I have a perlbrew with a running perl 5.25.10 on MacOS Sierra

In /usr/local/bin/

I have a symbolic link "perl" pointing to ~/perl5/perlbrew/perls/perl-5.25.10/bin/perl

My CGI script is running local on apache server and mysql

Starting my CGI Script with

#!/usr/bin/perl

Everything is working. But not with

#!/usr/local/bin/perl

My CGI script uses following modules: CGI DBD::mysql DBI which are listed by

perlbrew list-modules

The apache error_log seems to stop at the first module: CGI with error:

BEGIN failed--compilation aborted at /Library/WebServer/CGI-Executables/todo04.pl line 25.

My paths are configured right (means right order):

/Users/mstep/perl5/perlbrew/bin
/Users/mstep/perl5/perlbrew/perls/perl-5.25.10/bin
/Users/mstep/perl5/bin
/usr/local/bin
/usr/local/sbin
/usr/bin
/bin
/usr/sbin
/sbin
/opt/X11/bin
/usr/local/MacGPG2/bin
/usr/local/mysql/bin
/Users/mstep/perl5/bin
/Applications/Rakudo/bin
/Applications/Rakudo/share/perl6/site/bin
/Library/TeX/texbin

perlbrew is switched to:
* perl-5.25.10

Can someone help me out to config perlbrew?
Thank you in advance

marek

Replies are listed 'Best First'.
Re: perlbrew configuration and CGI Script
by huck (Prior) on Mar 04, 2017 at 19:23 UTC

    what are the permissions on ~/perl5/perlbrew/perls/perl-5.25.10/ and all its sub(dirs/files)? Can it be the cgi runs under a different user/group?

      Thank you for your replies!

      ~/perl5 and all subfolders are all set to my user name and staff mstep:staff

      So I have to look into my /etc/apache2/httpd.conf file?

        Ah but what does apache run under?

        $ps -ef | grep apa www-data 1785 1780 0 Mar03 ? 00:00:00 /usr/sbin/apache2 -k s +tart ... $ groups www-data www-data : www-data huck
        Its my playground, i just placed it into my group, is yours in staff?

        Edit:, and im assuming the modes are u+rwx g+rx, on the sub/files. if your other mode is --- or --x dir/file-modes could be the problem if www-data(or whatever) is not in staff

Re: perlbrew configuration and CGI Script
by Anonymous Monk on Mar 04, 2017 at 10:23 UTC
    Why was compilation aborted?

      the error_log on /var/log/apache2/ says only cgi:error and one line (25) and BEGIN failed--compilation aborted

      line 25: use CGI qw(:standard);

      It looks like the apache server does not find the modules installed by perlbrew ...

      I forgot to mention, that I have also homebrew installed ...

        Thats weird. If perl cant find CGI.pm in @INC the error message will reflect that. Apache isnt known for swallowing error messages. You need to through this checklist CGI Help Guide. Ill guess its a permission issue, but the error message should reflect that also