0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Mac版ApacheのPerlでPERL5LIBへパスを通す

Posted at

Mac版ApacheのPerlでPERL5LIBへパスを通す

Apache CGI 実行環境を整える

Perl wiki エンジンを試そうとMacで動かして出たエラーが意味不明で苛ついたわたしです。
だんだんやさぐが酷くなり、Apachログを見るコマンドなんてどんどん雑になっていきます。
次のコマンドを打ち込んで Alt+k ですよ。効率的で大変よろしいかと思います。

FireZone ~$ tail -f /var/log/apache2/*


FireZone ~$ perl -Mmod_perl -E 'say $mod_perl::VERSION'
Can't locate mod_perl.pm in @INC (you may need to install the mod_perl module) (@INC contains: /Users/lucky/perl5/lib/perl5/darwin-2level /Users/lucky/perl5/lib/perl5 /Users/lucky/.plenv/versions/5.34.0/lib/perl5/site_perl/5.34.0/darwin-2level /Users/lucky/.plenv/versions/5.34.0/lib/perl5/site_perl/5.34.0 /Users/lucky/.plenv/versions/5.34.0/lib/perl5/5.34.0/darwin-2level /Users/lucky/.plenv/versions/5.34.0/lib/perl5/5.34.0).
BEGIN failed--compilation aborted.
FireZone ~$

で、です。
動かした時に、上記のような(それっぽく適当なコマンドを実行しました)エラーが出るんですよ。
試行錯誤し、なんとかバージョン5 perlが動くようになった時でしたか。

こちらもご覧くださし > mod_perlを有効にするとperlバージョンて固定されるのね知らなかったよ。

httpd.conf に環境変数埋め込んでやればいけます

/etc/apache2/httpd.conf 287行目ぐらい 作業用ディレクトリのディレクティブ
DocumentRoot "/var/www"
<Directory "/var/www">
    SetEnv PATH "/Users/lucky/perl5/bin:$PATH"
    SetEnv PERL_CPANM_OPT "--local-lib=/Users/lucky/perl5"
    SetEnv PERL5LIB "/Users/lucky/perl5/lib/perl5:$PERL5LIB"

    Options Indexes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    MultiviewsMatch Any
    AddHandler cgi-script .cgi .pl
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
    AllowOverride all
    Require all granted
</Directory>

Apache 再起動でたぶん行ける

でもでも

Docker で Perl 使えば良かったと反省している

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?