I can do all things de-scripted in http://perl.apache.org/docs/2.0/user/intro/start_fast.html
The code I pasted here is one of the example in that page. two DBI related statements causes problem. Thanks and wishes. Haiyan On 01/31/2013 12:59 PM, zhe.chen wrote: > mod_perl提供一个类似于内置的perl解释器,不清楚apache配置里有没有禁 > 止embedded perl的选项; > 可以试下 在你的代码中去掉socket链接,host连接避免使用域名,用ip地址连 > 接,端口是否正确也检查下; > > FYI:http://perl.apache.org/ > > 2013/1/30 Haiyan Lin <[email protected] <mailto:[email protected]>> > > 大家好, > > 我用Apache+Mod_perl +MySQL +Mason的时候碰到一个问题,请问大家,改 > 如何解 决。谢谢。 > > 用DBI链接MySQL,在命令行执行没问题,但在Apache环境中用Mod_perl执 > 行,报错 > Can't connect to local MySQL server through socket '/tmp/mysql.sock' > > 代码如下 > > #!/usr/bin/perl > use DBI; > my $dbh = > > DBI->connect("dbi:mysql:host=localhost:datase=seedBase:mysql_socket=/tmp/mysql.sock",'user','password', > {'RaiseError' => 1}) or die $! ; > > print "Content-type: text/plain\n\n"; > print "mod_perl 2.0 rocks! \n"; > > 去掉DBI链接的语句后,通过Apache环境中用Mod_perl执行下面的,也很正常, > #!/usr/bin/perl > print "Content-type: text/plain\n\n"; > print "mod_perl 2.0 rocks! \n"; > > 祝各位顺利抢到火车飞机票,想去哪儿,就去那儿。 > > 海艳 > > > -- > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨 > 论组”论坛。 > 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 > [email protected] > <mailto:perlchina%[email protected]>。 > 要向此网上论坛发帖,请发送电子邮件至 [email protected] > <mailto:[email protected]>。 > 通过以下网址访问此论坛:http://groups.google.com/group > /perlchina?hl=zh-CN。 > 要查看更多选项,请访问 https://groups.google.com/groups/opt_out。 > > > > > > -- > [email protected] <mailto:[email protected]> -- > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组” > 论坛。 > 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 > [email protected]。 > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 > 通过以下网址访问此论坛:http://groups.google.com /group > /perlchina?hl=zh-CN。 > <http://groups.google.com/group/perlchina?hl=zh-CN%A1%A3> > 要查看更多选项,请访问 https://groups.google.com /groups/opt_out。 > <https://groups.google.com/groups/opt_out%A1%A3> > > -- 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 [email protected]。 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。 要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
