Ask a Question related to PERL Miscellaneous, Design and Development.
-
RB #1
perl + mysql + apache on windows
I am running mySQL 3.23.57 on windows 2000. I configured it to run on named
pipes ( enable-named-pipe ), and the server starts nicely. I have a perl
script which tries to establish a connection to mySQL server:
use DBI;
my $dsn = 'dbi:mysql:mydatabase';
# set the user and password
my $user = 'root';
my $pass = 'xxxxxxxxx';
# now connect and get a database handle
my $dbh = DBI->connect($dsn, $user, $pass);
# or die "Can't connect to the DB: $DBI::errstr\n";
print "done"
When I run this from the command line, the output is a string "done".
When I run the same perl script under cgi-bin using Apache(2.0.47), I can
see the following in the error_log:
[Mon Aug 11 14:42:23 2003] [error] [client w.x.y.z] DBI
connect('mydatabase','root',...) failed: Can't connect to MySQL server on
'localhost' (10061) at E:/Program
Files/ApacheGroup/Apache2/cgi-bin/testdb.pl line 17
[Mon Aug 11 14:42:23 2003] [error] [client w.x.y.z] Can't connect to the DB:
Can't connect to MySQL server on localhost' (10061)
I can of course do this from a shell prompt:
mysql -u root -p mydatabase
mysqld-nt is not listening on port 3306 ( netstat -a shows this )....
What am I missing here? Why do I get the 10061 error ( which seems to be a
Winsock error code - connection refused ).
thanks,
rb
RB Guest
-
which server for PHP, Mysql and apache for windows?
I'd like to install a server for PHP, Mysql and Apache. I use Phpdev but there is a problem: how do not allow the access to mysql by phpMyAdmin? I... -
Off Topic: Active Perl Native Windows / cygwin perl
I have both activestate windows native perl installed and the default cygwin perl. How can I have the cygwin shell use the windows perl rather... -
Configuring Jpgraph on Windows 2000+Apache+PHP+MySql server
Could someone walk me step by step on how to install and get JpGraph running on a Windows 2000+Apache+PHP+MySql server? -Thanks Jeff -
Need Install instructions for PHP, MySQL, and Apache on Windows OS.
Dear Colleagues: In need help in finding install instructions for PHP, MySQL, and Apache on Windows OS. Thanks for your help! Regards, Taino -
Windows 2k, Apache, MySQL, PHP 4.3.2, Smarty
Problem with Smarty. My application is giving me an error when i try to use smarty on a new WAMP install. Smarty is in my include path. Getting... -
Mothra #2
Re: perl + mysql + apache on windows
Hello,
"RB" <raja_babu0@lycos.com> wrote in message
news:Usb_a.175998$rsJ.6273@news04.bloor.is.net.cab le.rogers.com...[snipped]>
[more snippage]> use DBI;
>
> my $dsn = 'dbi:mysql:mydatabase';
for my $dsn I use
$dsn = "DBI:mysql:database=seating;host=cypci748";
It has the hostname, just a though :)
Hope this helps
Mothra
Mothra Guest
-
Gunnar Hjalmarsson #3
Re: perl + mysql + apache on windows
RB wrote:
<snip>>
> my $dsn = 'dbi:mysql:mydatabase';
Without really knowing the answer to your question, when playing with> What am I missing here? Why do I get the 10061 error ( which seems to be a
> Winsock error code - connection refused ).
MySQL on my local Windows 98 box, I have experienced that I need to
explicitly state 'localhost'. Doing so might be worth a try:
my $dsn = 'dbi:mysql:mydatabase:localhost';
--
Gunnar Hjalmarsson
Email: [url]http://www.gunnar.cc/cgi-bin/contact.pl[/url]
Gunnar Hjalmarsson Guest
-
RB #4
Re: perl + mysql + apache on windows
Hi,
I tried what you suggested - changing the dsn to
'dbi:mysql:database=mydatabase:host=localhost' - it had no effect - I still
get the connect error...
thanks,
rb
"Mothra" <mothra@nowhereatall.com> wrote in message
news:3f37f83e$1@usenet.ugs.com...> Hello,
>
> "RB" <raja_babu0@lycos.com> wrote in message
> news:Usb_a.175998$rsJ.6273@news04.bloor.is.net.cab le.rogers.com...> [snipped]> >
>> [more snippage]> > use DBI;
> >
> > my $dsn = 'dbi:mysql:mydatabase';
>
> for my $dsn I use
> $dsn = "DBI:mysql:database=seating;host=cypci748";
> It has the hostname, just a though :)
>
> Hope this helps
>
> Mothra
>
>
RB Guest
-
RB #5
Re: perl + mysql + apache on windows
I tried what you suggested - i modifed the dsn to be something like:
my $dsn = 'dbi:mysql:database=mydatabase:host=localhost'
it had no effect - I still get the connect error...
thanks,
"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:bhbhcb$10b5a5$1@ID-184292.news.uni-berlin.de...a> RB wrote:>> >
> > my $dsn = 'dbi:mysql:mydatabase';
> <snip>
>> > What am I missing here? Why do I get the 10061 error ( which seems to be>> > Winsock error code - connection refused ).
> Without really knowing the answer to your question, when playing with
> MySQL on my local Windows 98 box, I have experienced that I need to
> explicitly state 'localhost'. Doing so might be worth a try:
>
> my $dsn = 'dbi:mysql:mydatabase:localhost';
>
> --
> Gunnar Hjalmarsson
> Email: [url]http://www.gunnar.cc/cgi-bin/contact.pl[/url]
>
RB Guest
-
Mothra #6
Re: perl + mysql + apache on windows
Please do not top post. It anoys the regulars here
[text rearranged]
"RB" <raja_babu0@lycos.com> wrote in message
news:NVb_a.176187$rsJ.40778@news04.bloor.is.net.ca ble.rogers.com...still> "Mothra" <mothra@nowhereatall.com> wrote in message
> news:3f37f83e$1@usenet.ugs.com...>"RB" <raja_babu0@lycos.com> wrote> > Hello,
> >
> > "RB" <raja_babu0@lycos.com> wrote in message
> > news:Usb_a.175998$rsJ.6273@news04.bloor.is.net.cab le.rogers.com...> > [snipped]> > >
> >> > [more snippage]> > > use DBI;
> > >
> > > my $dsn = 'dbi:mysql:mydatabase';
> >
> > for my $dsn I use
> > $dsn = "DBI:mysql:database=seating;host=cypci748";
> > It has the hostname, just a though :)
> >
> Hi,
>
> I tried what you suggested - changing the dsn to
> 'dbi:mysql:database=mydatabase:host=localhost' - it had no effect - Iyou might want to try:> get the connect error...
>
telnet localhost 3306
and see if you can get a connection. then troubleshoot from there
Mothra
Mothra Guest
-
ctcgag@hotmail.com #7
Re: perl + mysql + apache on windows
"RB" <raja_babu0@lycos.com> wrote:
> I am running mySQL 3.23.57 on windows 2000. I configured it to run on
> named pipes ( enable-named-pipe ), and the server starts nicely. I have a
> perl script which tries to establish a connection to mySQL server:
>
> use DBI;
>
> my $dsn = 'dbi:mysql:mydatabase';
>
> # set the user and password
> my $user = 'root';
> my $pass = 'xxxxxxxxx';
>
> # now connect and get a database handle
> my $dbh = DBI->connect($dsn, $user, $pass);
> # or die "Can't connect to the DB: $DBI::errstr\n";
> print "done"
>
> When I run this from the command line, the output is a string "done".
>
> When I run the same perl script under cgi-bin using Apache(2.0.47), I can
> see the following in the error_log:
>
> [Mon Aug 11 14:42:23 2003] [error] [client w.x.y.z] DBI
> connect('mydatabase','root',...) failed: Can't connect to MySQL server on
> 'localhost' (10061) at E:/Program
> Files/ApacheGroup/Apache2/cgi-bin/testdb.pl line 17
> [Mon Aug 11 14:42:23 2003] [error] [client w.x.y.z] Can't connect to the
> DB: Can't connect to MySQL server on localhost' (10061)
Pardon if this question doesn't make sense on Windows, but who is apache
running as? Who are you running as when you do it from the command
line? Who has permissions on the named pipe?
Xho
--
-------------------- [url]http://NewsReader.Com/[/url] --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
ctcgag@hotmail.com Guest
-
raja babu #8
Re: perl + mysql + apache on windows
OK - I finally got it to work. And the culprit is Apache on win32.
Somehow it does always tries to connect to mySQL using TCP ( which
explains the earlier error log entry : Can't connect to MySQL server
on 'localhost' (10061) ). So, I configured mySQL to use TCP/IP and
provide the host name in the dsn variable as suggested here : my $dsn
= "dbi:mysql:database=mydatabase:host=myhostname "; - and it worked
this time.
thanks for all the replies...
rb
[email]raja_babu0@lycos.com[/email] (raja babu) wrote in message news:<67505fb2.0308130454.52dfd55c@posting.google. com>...> well, I login to the machine as Administrator. The Apache config file
> ( httpd.conf ) has no mention of any user under which it is running -
> so it could be running under the Admnistrator account. When I do it
> from the command line I am running as Administrator. I do not know who
> has permissions on the named pipe - how do I find out?
>
> rb
>
> [email]ctcgag@hotmail.com[/email] wrote in message news:<20030812170712.414$aG@newsreader.com>...
>> > Pardon if this question doesn't make sense on Windows, but who is apache
> > running as? Who are you running as when you do it from the command
> > line? Who has permissions on the named pipe?
> >
> > Xhoraja babu Guest
-
Ravi Patel #9
Re: perl + mysql + apache on windows
This problem is due to some problem with environment variable....
and thus apache tomcat is not able to connect to the mysql
Do the following to solve the problem.....
Open [tomcat home]/conf/web.xml
You will find following code :::::::::::::
<servlet>
<servlet-name>cgi</servlet-name>
<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>cgiPathPrefix</param-name>
<param-value>WEB-INF/cgi</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>
In this code add the following code::::::
<init-param>
<param-name>passShellEnvironment</param-name>
<param-value>true</param-value>
</init-param>
So the resulting code will be :::::::::::::
<servlet>
<servlet-name>cgi</servlet-name>
<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>cgiPathPrefix</param-name>
<param-value>WEB-INF/cgi</param-value>
</init-param>
<init-param>
<param-name>passShellEnvironment</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>
Now save the web.xml file and restart your apache tomcat server.
And now run your perl-cgi page containing code to connect to the MySQL
You are done... :-)Ravi Patel Guest



Reply With Quote

