Web Hosting Talk







View Full Version : Module listing


NewonNet
07-30-2001, 09:08 AM
What commands are use to find out all the modules installed on the server?

For apache modules?

For perl modules?

Thanks.

Helicon
07-30-2001, 03:01 PM
There are two ways, depend on the version of your apache and how you compiled it.

/usr/sbin/httpd -l

or

take a look at the file /etc/httpd/conf/httpd.conf, look at the AddModule statements


For Perl Modules, depends how your site is constructed, but usually, you can find all the modules under this directory: /usr/lib/perl5

The Prohacker
07-30-2001, 03:52 PM
Make a cgi file in your cgi-bin, and chmod it, and dump this as the contents:


#!/usr/bin/perl

print "Content-type: text/html\n\n";
print <<HTML;
<html>
<head>
<title>Perl Check</title>
</head>
<BODY BGCOLOR="#999999" TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000">
<center>
<table bgcolor="#000000" cellpadding="0" cellspacing="0" width="600" border="0">
<tr>
<th>
<table bgcolor="#000000" cellpadding="4" cellspacing="1" width="600" border="0">
<tr>
<th bgcolor="#666666"><font color="#FFFFFF">Perl Check</th>
</tr>
<tr>
<th bgcolor="#999999">
<form>
<textarea name="" rows="10" cols="80" style="background-color: #999999 ; font-size: 8pt; color: #000000 ; font-family: Verdana">
HTML

print "Perl Version: $]\n\n";

$mail_prog = "/usr/lib/sendmail";
$result = &find_mail ($mail_prog);
if (! $result) {
$mail_prog = "/usr/sbin/sendmail";
$result = &find_mail ($mail_prog);
if (! $result) {
$mail_prog = "/var/qmail/bin/qmail-inject";
$result = &find_mail ($mail_prog);
if (! $result) { $mail_prog = "Unknown"; }
}
}

print "Server Mail Program Path: $mail_prog\n\n";

foreach $item (keys %ENV) { print "$item = $ENV{$item}\n";}
$curr_dir = `pwd`;
print "\nCurrent Directory: $curr_dir\n";

print "Installed Modules:\n";
print "==================\n";

use File::Find;
my (@mod, %done, $dir);

find (\&get_module, grep { -r and -d } @INC);
@mod = grep (!$done{$_}++, @mod);
foreach $dir (sort { length $b <=> length $a } @INC) {
foreach (@mod) { next if s,^\Q$dir,,; }
}
foreach (@mod) { s,^/(.*)\.pm$,$1,; s,/,::,g; print "$_\n"; }
print "\nNumber Modules Installed: $#mod";

print <<HTML;
</textarea>
</form>
</th>
</tr>
</table>
</th>
</tr>
</table>
</center>

</body>
</html>
HTML
exit;
sub find_mail {

my $path = shift (@_);

unless (-e "$path") { return 0; }
return 1;
}

sub get_module {

/^.*\.pm$/ && /$ARGV[0]/i && push @mod, $File::Find::name;
}
exit;

allan
07-30-2001, 09:20 PM
I don't want to get into a coding contest with ph :D, but you can pull all this from the command line by typing:



find `perl -e 'print "@INC"'` -name '*.pm' -print



you can | it to a file if you want to save ti for viewing.

NewonNet
07-30-2001, 11:24 PM
Very good.

Thanks guys.