2011-08-23

Slitaz -- Oracle XE - perl - lighttpd



Oracle 10g XE + DBD::Oracle + FastCGI

Fast CGI on Lighttpd

Invocation number 4 PID 14231.


Requested uri is /index.html
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production


1.
oracle@slitaz:~$ ps ax | grep httpd
14221 www        0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
14222 www        0:00 /usr/bin/perl /usr/bin/lighttpd.fcgi
14225 www        0:00 /usr/bin/perl /usr/bin/lighttpd.fcgi
14228 www        0:00 /usr/bin/perl /usr/bin/lighttpd.fcgi
14231 www        0:00 /usr/bin/perl /usr/bin/lighttpd.fcgi
14239 root       0:00 leafpad /var/log/lighttpd/error.log
14376 oracle     0:00 grep httpd

2.
oracle@slitaz:~$ ls /tmp/fastcgi.socket*
/tmp/fastcgi.socket-0  /tmp/fastcgi.socket-2
/tmp/fastcgi.socket-1  /tmp/fastcgi.socket-3

3.
oracle@slitaz:~$ cat /usr/bin/lighttpd.fcgi
#!/usr/bin/perl
use CGI::Fast qw(:standard);
use DBI;
use URI;
$ENV{FCGI_SOCKET_PATH} = "/tmp/fastcgi.socket";
$ENV{FCGI_LISTEN_QUEUE} = 100;
$COUNTER = 0;
my $dbh = DBI->connect('dbi:Oracle:', 'hr@localhost/XE', 'oracle') || die ;

while (new CGI::Fast) {
    print header;
    print start_html("Fast CGI Rocks");
    print
        h1("Fast CGI on Lighttpd"),
        "Invocation number ",b($COUNTER++),
        " PID ",b($$),".",
        hr;
    my $uri = URI->new( $ENV{REQUEST_URI} );
    print br;
    print "Requested uri is ",b($uri);
    my $sql = 'SELECT * from v$version';
    my $sth = $dbh->prepare($sql);
    $sth->execute();
    while (my (@s) = $sth->fetchrow_array())
    {
        print br;
        print b($s[0]);
    }
    print end_html;
}

4.
oracle@slitaz:~$ netstat -nltp
netstat: showing only processes with your user ID
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      10723/tnslsnr
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN      10723/tnslsnr
tcp        0      0 0.0.0.0:55037           0.0.0.0:*               LISTEN      10749/xe_d000_XE
tcp        0      0 :::6000                 :::*                    LISTEN      -
oracle@slitaz:~$
.