Showing posts with label Perl. Show all posts
Showing posts with label Perl. Show all posts

Saturday, June 11, 2011

Perl Errors Installing Net::SSLeay or Crypt::SSLeay from CPAN

I've run into this same problem enough times now that I figure it's worth posting: Attempting to install Net::SSLeay or Crypt::SSLeay via CPAN on a clean system results in a number of unexpected errors despite having openssl already installed. Typicall errors include the following (plus a few thousand more of equal or lesser value):

SSLeay.xs:98:25: error: openssl/err.h: No such file or directory
SSLeay.xs:99:27: error: openssl/lhash.h: No such file or directory
SSLeay.xs:100:26: error: openssl/rand.h: No such file or directory
SSLeay.xs:101:28: error: openssl/buffer.h: No such file or directory
SSLeay.xs:102:25: error: openssl/ssl.h: No such file or directory
SSLeay.xs:103:74: error: openssl/comp.h: No such file or directory
SSLeay.xs:105:25: error: openssl/md2.h: No such file or directory
SSLeay.xs:107:25: error: openssl/md4.h: No such file or directory
SSLeay.xs:108:93: error: openssl/md5.h: No such file or directory
SSLeay.xs:112:26: error: openssl/x509.h: No such file or directory
SSLeay.xs:113:28: error: openssl/x509v3.h: No such file or directory
SSLeay.xs:114:28: error: openssl/engine.h: No such file or directory
SSLeay.xs:134: error: expected â;â, â,â or â)â before â*â token
SSLeay.xs:135: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â*â token
SSLeay.xs:136: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â*â token

The fix for this is always the same. These modules don't merely require an install of openssl, but instead need a full openssl-devel installation as well.

[root@whatever]# yum install openssl-devel

That is all... Breckenridge!

Thursday, March 03, 2011

Apache 2, mod_perl, HTML::Mason, "use lib" and "Can't Locate" issues with @INC

Long title, but accurate. This is a short tidbit for anyone who is experiencing errors with mod_perl relating to being unable to locate modules from a directory in @INC specified via a "use lib" statement.

My personal setup involved an Apache 2 directive within a VirtualHost utilizing HTML::Mason that referenced a "PerlRequire" module that in turn added a specific "use lib" path (/var/www/html/lib) to @INC for use of personal libraries within a new site I had been setting up.

Every single syshandler, autohandler, or page referencing any module within the specified path was crashing with an error that Perl "can't locate" the module in question within the known set of @INC paths (which visibly contained the correct path to the modules in question).

Many hours of Googling found numerous answers suggesting file/directory permission errors, however even setting 777 on every directory and file in question resulted in the same failed outcome.

Almost by accident I checked /var/log/messages and saw something similar to the following:

Mar  3 19:09:21 test_server1 kernel: type=1400 audit(1299197361.362:4):
avc: denied { getattr } for pid=1812 comm="httpd"
path="/var/www/html/lib"
dev=dm-0 ino=3342348 scontext=user_u:system_r:httpd_t:s0
tcontext=user_u:object_r:user_home_t:s0 tclass=dir

As soon as I saw this, the light bulb illuminated... This was a new CentOS 5 server and I had forgotten to disable SELinux.

For anyone else experiencing this issue, merely edit /etc/sysconfig/selinux and set "SELINUX=disabled" then reboot, you should be good to go.

The bigger question here is why SELinux would be enabled by default on most servers, but I'll leave that for the philosophers of the world, I've got better things to do.