直接 tcp/ip连接可以吧? 在 2013年1月31日下午12:59,zhe.chen <chenzh...@gmail.com>写道:
> mod_perl提供一个类似于内置的perl解释器,不清楚apache配置里有没有禁止embedded perl的选项; > 可以试下 在你的代码中去掉socket链接,host连接避免使用域名,用ip地址连接,端口是否正确也检查下; > > FYI:http://perl.apache.org/ > > > 2013/1/30 Haiyan Lin <linhy0...@gmail.com> > >> 大家好, >> >> 我用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 讨论组”论坛。 >> 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 >> perlchina+unsubscribe@**googlegroups.com<perlchina%2bunsubscr...@googlegroups.com> >> 。 >> 要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。 >> 通过以下网址访问此论坛:http://groups.**google.com/group/perlchina?hl=**zh-CN<http://groups.google.com/group/perlchina?hl=zh-CN> >> 。 >> 要查看更多选项,请访问 >> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >> 。 >> >> >> > > > -- > chenzh...@gmail.com > > -- > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 > 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 perlchina+unsubscr...@googlegroups.com。 > 要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。 > 通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。 > 要查看更多选项,请访问 https://groups.google.com/groups/opt_out。 > > > -- 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 perlchina+unsubscr...@googlegroups.com。 要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。 通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。 要查看更多选项,请访问 https://groups.google.com/groups/opt_out。