Discussion:
Problem wit loading CTLib via CGI on WinXp
Julian Thomas
2008-12-18 12:07:56 UTC
Permalink
Hi

The scripts work perfectly when run via acommand prompt or through an
IDE
But when I try to run them via Apache2.2 I get the following errors.


Software error:

Can't load 'D:/perl.5.8.8/site/lib/auto/Sybase/CTlib/CTlib.dll' for
module Sybase::CTlib: load_file:The specified module could not be found
at D:/perl.5.8.8/lib/DynaLoader.pm line 229.
at D:/Apps/Apache2.2/cgi-bin/simple.cgi line 20
Compilation failed in require at D:/Apps/Apache2.2/cgi-bin/simple.cgi
line 20.
BEGIN failed--compilation aborted at
D:/Apps/Apache2.2/cgi-bin/simple.cgi line 20.

if i print the Environment out before the use Sybase::CTLib call I get
COMSPEC= C:\WINDOWS\system32\cmd.exe

DOCUMENT_ROOT= D:/Apps/Apache2.2/htdocs

GATEWAY_INTERFACE= CGI/1.1

HTTP_ACCEPT= */*

HTTP_ACCEPT_ENCODING= gzip, deflate

HTTP_ACCEPT_LANGUAGE= en-gb

HTTP_CONNECTION= Keep-Alive

HTTP_HOST= ldn1dpc383.globeop.com

HTTP_UA_CPU= x86

HTTP_USER_AGENT= Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET
CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1; .NET CLR
3.0.04506.648)

LD_LIBRARY_PATH= Z:\Apps\sybase\OCS-12_5\dll

LIB= Z:\Apps\sybase\OCS-12_5\lib

PATH=
D:\Perl.5.8.8\bin;D:\Perl.5.8.8\site\bin;D:\Perl.5.8.8\bin;z:\Apps\sybas
e\odbc\ODBC;C:\Program Files\ActiveState Komodo Edit
4.2\;C:\Python25\;D:\Perl\bin;z:\Apps\sybase\OCS-12_5\lib3p;z:\Apps\syba
se\OCS-12_5\dll;z:\Apps\sybase\OCS-12_5\bin;C:\WINDOWS\system32;C:\WINDO
WS;C:\WINDOWS\System32\Wbem

PATHEXT= .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.py;.pyw

QUERY_STRING=

REMOTE_ADDR= 172.27.40.242

REMOTE_PORT= 3595

REQUEST_METHOD= GET

REQUEST_URI= /cgi-bin/printenv.cgi

SCRIPT_FILENAME= D:/Apps/Apache2.2/cgi-bin/printenv.cgi

SCRIPT_NAME= /cgi-bin/printenv.cgi

SERVER_ADDR= 172.27.40.242

SERVER_ADMIN= ***@globeop.com

SERVER_NAME= ldn1dpc383.globeop.com

SERVER_PORT= 80

SERVER_PROTOCOL= HTTP/1.1

SERVER_SIGNATURE=

SERVER_SOFTWARE= Apache/2.2.10 (Win32)

SYBASE= Z:\Apps\sybase

SYBASE_JRE= Z:\Apps\sybase\shared-1_0\JRE-1_3

SYBASE_OCS= OCS-12_5

SYSTEMROOT= C:\WINDOWS

WINDIR= C:\WINDOWS

Now this used to work so somthing has changed.

I attach the http.conf file

Any help would be appreciated

Rgds

Julian




--------------------------------------------------------------------------
This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.
(H1)
Julian Thomas
2009-02-04 09:09:08 UTC
Permalink
Any ideas

________________________________

From: owner-sybperl-***@peppler.org [mailto:owner-sybperl-***@peppler.org]
On Behalf Of Julian Thomas
Sent: 18 December 2008 12:08
To: sybperl-***@peppler.org
Subject: Problem wit loading CTLib via CGI on WinXp


Hi

The scripts work perfectly when run via acommand prompt or through an
IDE
But when I try to run them via Apache2.2 I get the following errors.


Software error:

Can't load 'D:/perl.5.8.8/site/lib/auto/Sybase/CTlib/CTlib.dll' for
module Sybase::CTlib: load_file:The specified module could not be found
at D:/perl.5.8.8/lib/DynaLoader.pm line 229.
at D:/Apps/Apache2.2/cgi-bin/simple.cgi line 20
Compilation failed in require at D:/Apps/Apache2.2/cgi-bin/simple.cgi
line 20.
BEGIN failed--compilation aborted at
D:/Apps/Apache2.2/cgi-bin/simple.cgi line 20.

if i print the Environment out before the use Sybase::CTLib call I get
COMSPEC= C:\WINDOWS\system32\cmd.exe

DOCUMENT_ROOT= D:/Apps/Apache2.2/htdocs

GATEWAY_INTERFACE= CGI/1.1

HTTP_ACCEPT= */*

HTTP_ACCEPT_ENCODING= gzip, deflate

HTTP_ACCEPT_LANGUAGE= en-gb

HTTP_CONNECTION= Keep-Alive

HTTP_HOST= ldn1dpc383.globeop.com

HTTP_UA_CPU= x86

HTTP_USER_AGENT= Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET
CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1; .NET CLR
3.0.04506.648)

LD_LIBRARY_PATH= Z:\Apps\sybase\OCS-12_5\dll

LIB= Z:\Apps\sybase\OCS-12_5\lib

PATH=
D:\Perl.5.8.8\bin;D:\Perl.5.8.8\site\bin;D:\Perl.5.8.8\bin;z:\Apps\sybas
e\odbc\ODBC;C:\Program Files\ActiveState Komodo Edit
4.2\;C:\Python25\;D:\Perl\bin;z:\Apps\sybase\OCS-12_5\lib3p;z:\Apps\syba
se\OCS-12_5\dll;z:\Apps\sybase\OCS-12_5\bin;C:\WINDOWS\system32;C:\WINDO
WS;C:\WINDOWS\System32\Wbem

PATHEXT= .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.py;.pyw

QUERY_STRING=

REMOTE_ADDR= 172.27.40.242

REMOTE_PORT= 3595

REQUEST_METHOD= GET

REQUEST_URI= /cgi-bin/printenv.cgi

SCRIPT_FILENAME= D:/Apps/Apache2.2/cgi-bin/printenv.cgi

SCRIPT_NAME= /cgi-bin/printenv.cgi

SERVER_ADDR= 172.27.40.242

SERVER_ADMIN= ***@globeop.com

SERVER_NAME= ldn1dpc383.globeop.com

SERVER_PORT= 80

SERVER_PROTOCOL= HTTP/1.1

SERVER_SIGNATURE=

SERVER_SOFTWARE= Apache/2.2.10 (Win32)

SYBASE= Z:\Apps\sybase

SYBASE_JRE= Z:\Apps\sybase\shared-1_0\JRE-1_3

SYBASE_OCS= OCS-12_5

SYSTEMROOT= C:\WINDOWS

WINDIR= C:\WINDOWS

Now this used to work so somthing has changed.

I attach the http.conf file

Any help would be appreciated

Rgds

Julian



________________________________

This email with all information contained herein or attached hereto may
contain confidential and/or privileged information intended for the
addressee(s) only. If you have received this email in error, please
contact the sender and immediately delete this email in its entirety and
any attachments thereto.
(H1)


--------------------------------------------------------------------------
This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.
(H1)
Ed Avis
2009-02-04 11:20:38 UTC
Permalink
Can't load 'D:/perl.5.8.8/site/lib/auto/Sybase/CTlib/CTlib.dll' for module Sybase::CTlib: load_file:The specified module could not be found at D:/perl.5.8.8/lib/DynaLoader.pm line 229.

Does that file exist?

--
Ed Avis <***@waniasset.com>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Julian Thomas
2009-02-04 13:49:06 UTC
Permalink
yes

It all runs fine via the commandline or perl express just wont through
CGI using Internet explorer
Something to do with apache I guess

-----Original Message-----
From: Ed Avis [mailto:***@waniasset.com]
Sent: 04 February 2009 11:21
To: Julian Thomas; sybperl-***@peppler.org
Subject: RE: Problem wit loading CTLib via CGI on WinXp

Can't load 'D:/perl.5.8.8/site/lib/auto/Sybase/CTlib/CTlib.dll' for
module Sybase::CTlib: load_file:The specified module could not be found
at D:/perl.5.8.8/lib/DynaLoader.pm line 229.

Does that file exist?

--
Ed Avis <***@waniasset.com>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

--------------------------------------------------------------------------
This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.
(H1)
Ed Avis
2009-02-04 13:51:37 UTC
Permalink
Is Apache running under a user account that can't access drive D:?

--
Ed Avis <***@waniasset.com>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Julian Thomas
2009-02-04 13:54:17 UTC
Permalink
Its running on my local machine from 'D' Drive
and I am administrator both of apache and my PC.

The Perl Libraries are in that location and if I get the environment
from a perl CGI Script everything seems to point to the right places

-----Original Message-----
From: Ed Avis [mailto:***@waniasset.com]
Sent: 04 February 2009 13:52
To: Julian Thomas; sybperl-***@peppler.org
Subject: RE: Problem wit loading CTLib via CGI on WinXp

Is Apache running under a user account that can't access drive D:?

--
Ed Avis <***@waniasset.com>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

--------------------------------------------------------------------------
This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.
(H1)
Julian Thomas
2009-02-04 14:03:09 UTC
Permalink
No tried that

It just bows out at the use statement

-----Original Message-----
From: Ed Avis [mailto:***@waniasset.com]
Sent: 04 February 2009 13:57
To: Julian Thomas; sybperl-***@peppler.org
Subject: RE: Problem wit loading CTLib via CGI on WinXp

>Its running on my local machine from 'D' Drive and I am administrator
>both of apache and my PC.

Yes but can Apache read that file? What happens if you write a simple
CGI script that tries to open the file and get its contents?

--
Ed Avis <***@waniasset.com>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

--------------------------------------------------------------------------
This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.
(H1)
Ed Avis
2009-02-04 14:06:20 UTC
Permalink
What I mean is this.

Write an ordinary CGI program - not using CTlib or anything fancy - that just tries to open a file and report how many bytes the file contains. Or if it fails to open the file it reports why (using $!).

First of all do it with some file that you know exists and is definitely readable, like C:\windows\win.ini or whatever. That will tell you your script is working.

Then try changing the filename to the one that is failing. What happens now?

That will let you see whether Apache, and CGI scripts it is running, can read that file.

--
Ed Avis <***@waniasset.com>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Ed Avis
2009-02-04 14:44:05 UTC
Permalink
Your attached test script is very complicated - it does all sorts of stuff apart from opening a file. Couldn't you make a simple script that just does that?

However, it looks like the open() call is not correct - you have

open(INTERFACES)

which will open a file called 'interfaces', and not give any error if it fails! You would need something like

my $filename = 'whatever';
my $fh; # file handle
open $fh, '<', $filename
or die "cannot open $filename for reading: $!";

I think you need to make a test program as I suggested, and if you don't know how to do that, find a local perl programmer who does.

--
Ed Avis <***@waniasset.com>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Julian Thomas
2009-02-04 15:09:02 UTC
Permalink
Hi

We now have

#!d:\perl.5.8.8\bin\perl

use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
$q = new CGI; # create new CGI object
print $q->header, $q->start_html("File Size");
print $q->start_form;
print h1("File Size");

my $filename =
"D:\\perl.5.8.8\\site\\lib\\auto\\Sybase\\CTlib\\CTLIB.dll";
my $fh; # file handle
open $fh, '<', $filename
or die "cannot open $filename for reading: $!";

$Size = -s $fh;
print p("Size of $filename = $Size bytes");

print $q->end_form,$q->hr();
print $q->end_html;

which gives us

File Size
Size of D:\perl.5.8.8\site\lib\auto\Sybase\CTlib\CTLIB.dll = 127057
bytes

So we can obviously read the file ok
The open call from the earlier script was reading the contents of the
list box from file and that all seemed ok

I think it must be something to do with the path of some env variable.

-----Original Message-----
From: Ed Avis [mailto:***@waniasset.com]
Sent: 04 February 2009 14:44
To: Julian Thomas; sybperl-***@peppler.org
Subject: RE: Problem wit loading CTLib via CGI on WinXp

Your attached test script is very complicated - it does all sorts of
stuff apart from opening a file. Couldn't you make a simple script that
just does that?

However, it looks like the open() call is not correct - you have

open(INTERFACES)

which will open a file called 'interfaces', and not give any error if it
fails! You would need something like

my $filename = 'whatever';
my $fh; # file handle
open $fh, '<', $filename
or die "cannot open $filename for reading: $!";

I think you need to make a test program as I suggested, and if you don't
know how to do that, find a local perl programmer who does.

--
Ed Avis <***@waniasset.com>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

--------------------------------------------------------------------------
This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.
(H1)
Ed Avis
2009-02-04 15:13:29 UTC
Permalink
>So we can obviously read the file ok
>The open call from the earlier script was reading the contents
>of the list box from file and that all seemed ok

Hmm. I am a bit stumped. I might try installing Strawberry Perl in C:\perl and installing the Sybase::CTlib module in that, but this would just be random experimentation.

>I think it must be something to do with the path of some env variable.

Might be, but I can't see anything obvious. It's not that the filename is wrong - it has the correct filename but just can't load it for some reason. (Perhaps CTLIB.dll depends on some other DLL that can't be found?)

--
Ed Avis <***@waniasset.com>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Julian Thomas
2009-02-04 15:18:47 UTC
Permalink
Ok thanks for your Help

-----Original Message-----
From: Ed Avis [mailto:***@waniasset.com]
Sent: 04 February 2009 15:13
To: Julian Thomas; sybperl-***@peppler.org
Subject: RE: Problem wit loading CTLib via CGI on WinXp

>So we can obviously read the file ok
>The open call from the earlier script was reading the contents of the
>list box from file and that all seemed ok

Hmm. I am a bit stumped. I might try installing Strawberry Perl in
C:\perl and installing the Sybase::CTlib module in that, but this would
just be random experimentation.

>I think it must be something to do with the path of some env variable.

Might be, but I can't see anything obvious. It's not that the filename
is wrong - it has the correct filename but just can't load it for some
reason. (Perhaps CTLIB.dll depends on some other DLL that can't be
found?)

--
Ed Avis <***@waniasset.com>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

--------------------------------------------------------------------------
This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.
(H1)
Ed Avis
2009-02-04 13:56:40 UTC
Permalink
>Its running on my local machine from 'D' Drive and I am
>administrator both of apache and my PC.

Yes but can Apache read that file? What happens if you write a simple CGI script that tries to open the file and get its contents?

--
Ed Avis <***@waniasset.com>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Loading...