i've been trying to connect to a db using this code: - #!"C:\xampp\perl\strawberry\perl\bin\perl.exe"
-
use DBI;
-
use strict;
-
use warnings;
-
-
print "Content-type: text/html \n\n"; #HTTP HEADER
-
my $dbh = DBI->connect("DBI:mysql:survey","root","") or die "Couldn't connect to database: " . DBI->errstr;
but it does not work, i dont get the die error message only this default xampp error :
Server error!
The server encountered an internal error and was unable to complete your request.
Error message: - Premature end of script headers: DB.pl
-
-
If you think this is a server error, please contact the webmaster.
-
Error 500
-
localhost
-
12/06/09 11:00:53
-
Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.8
11 4297 RonB 589
Expert Mod 512MB
Did you check the apache error log?
It's probably due to your shebang line. Try changing it to this: - #!C:/xampp/perl/strawberry/perl/bin/perl.exe
Unfortunately, I don't have any experience with xampp, so I am not aware of the caveats.
I guess my first question is, can you connect to the database manually from the command line? If not, what does it tell you?
Regards,
Jeff
RonB 589
Expert Mod 512MB
I just noticed that you have a syntax error in the error handling portion of the connect statement.
should be
Try this version: -
#!C:/xampp/perl/strawberry/perl/bin/perl.exe
-
-
use strict;
-
use warnings;
-
use DBI;
-
use CGI qw(:standard);
-
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
-
-
print header();
-
warningsToBrowser(1);
-
-
my $dbh = DBI->connect("DBI:mysql:survey", "root", "", { RaiseError => 1 } )
-
or die "Couldn't connect to database: " . $DBI::errstr;
-
-
print start_html(),
-
h1("It worked");
-
-
print end_html();
nothing works , i get this from apache log: - [Sun Dec 06 20:06:56 2009] [error] [client 127.0.0.1] Can't locate DBI.pm in @INC (@INC contains: C:/xampp/perl/strawberry/perl/lib C:/xampp/perl/strawberry/perl/site/lib C:\\strawberry\\perl\\vendor\\lib .) at C:/xampp/cgi-bin/DB.pl line 4.\r
-
[Sun Dec 06 20:06:56 2009] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at C:/xampp/cgi-bin/DB.pl line 4.\r
so it looks like it cant find DBI library but the library is there, I got perl strawberry.
RonB 589
Expert Mod 512MB
If DBI is on your system then based on the paths, I'd say that something wasn't installed properly, or you specified alternate directories during one of the installations and now you have a mix-match (conflict) in the directory structure.
Or, you have 2 separate installations of Perl (xampp and strawberry), which based on those paths is very likely.
xampp comes with perl/bin/perl.exe, wich i heard in some kind of mini perl.
when you install strawberry you cant choose directory installation it will install by default in C/program files. So i just changed it of directory and place it in xampp/perl
RonB 589
Expert Mod 512MB
That's the cause of your problem. Install one or the other, not both.
I don't like xampp because it leaves out a lot of standard modules, forcing you to install them yourself.
My only objection to strawberry is the limitation in its choice of installation locations. Last time I checked you had absolutely no control over its install location.
My preference is to use ActivePerl http://www.activestate.com/activeperl/ and install each of the other items (mysql and apache) separately. This give you the most flexibility.
So, my recommendation is to uninstall xampp and strawberry Perl and start over.
Personally, I prefer Strawberry Perl over Active State as AS has such a proprietory module installation system and does not allow you to install any cpan module.
I do agree with uninstalling xampp and SP and installing only one of them. Two Perls on one system is never good.
Regards,
Jeff
RonB 589
Expert Mod 512MB
Personally, I prefer Strawberry Perl over Active State as AS has such a proprietory module installation system and does not allow you to install any cpan module.
Actually, that's not true. The only thing missing from AS in their base install is the MinGW module (which is in AS's repository). MinGW installs the required compiler and configures CPAN.pm. I use AS's ppm utility for most of my installations, but I can and sometimes do install via cpan.
On the flip side, when using Strawberry Perl, you can install the ppm utility via cpan and have the choice of either cpan or ppm.
i have never installed this mini perl version that's included with xampp , it is install ed by default and it just consist of a bin directory with inside a perl.exe file so i dont see how this could be affecting anything, btw if i uninstall xampp i would need to install php, apache, mysql, perl, phpmydamin etc .. separately but i 've never done this and looks like overkill right now , any tutorials on this ?
thanks
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Subra Mallampalli |
last post by:
Hi,
I am trying to connect over HTTPS using a client certificate. I am able to
connect fine when using IE. From my application, however, I get the
following error:
The underlying connection...
|
by: pemigh |
last post by:
I'm almost done with an application, and trying to lock it down
tightly. But I still want users to be able to point to a new location
for the data file.
The code below fires off to detect and...
|
by: kkddrpg |
last post by:
the database looks like this
the database is called
username_tpp (not really just using username as a sub)
the table is called
home
it has
field 1 : varchar(50) | latin1_swedish_ci | no...
|
by: Marty |
last post by:
As said in the title I am trying to connect to a .WK1 file. Here is my
code so far:
If (.ShowDialog() = Windows.Forms.DialogResult.OK) Then
strFilePath =...
|
by: Newbie19 |
last post by:
I am trying to connect to a SQL DB and I have owner access, but I am unable to connect.
Here is my connectionstring:
Dim connectionString As String = _
"Data...
|
by: Alan Silver |
last post by:
Hello,
Server configuration:
Windows 2003 Server SP2
SQL Server 2000 SP4
..NET v2.0.50727
just built up a new server using the same configuration as my current
one. I even used the same CDs...
|
by: =?Utf-8?B?c2NodXJzdDMw?= |
last post by:
Hi, I am currently trying to get back into ASP and have begun looking at an
old webpage I developed some years ago, it was fully functional back in 2002
and I had it up and running with no...
|
by: danfolkes |
last post by:
Hey Everyone, I am trying to send repeated messages from a "Node" to a
"Server". It works the first time I send the from the Node to Server,
but after that it either errors, or does not do...
|
by: SRK |
last post by:
Hi,
I have installed free TDS ODBC driver on Linux and from there I am
trying to connect to MS SQLSERVER installed on Windows machine. But it
gives me following error -
tsql -H ps6312 -p 1433...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |