Sarpedon has asked for the wisdom of the Perl Monks concerning the following question:

I cannot connect to mysql 5.0.45 database when web sharing w/ Apache2 and Perl 5.8 &/or Activeperl 5.10 cgi scripts using Mac OS X Leopard 10.5.2 Altho I can connect to mysql when running the Perl scripts from the command line. The problem only occurs on my local web server in Mac OS X 10.5.2. On my other Mac running 10.3 the code runs fine, as it also does on my remote site. server error log: Can't locate DBD/mysql.pm . . . can someone please advise. Sarpedon Jones
  • Comment on Mac OS X 10.5.2 web server cannot connect to mysql

Replies are listed 'Best First'.
Re: Mac OS X 10.5.2 web server cannot connect to mysql
by marto (Cardinal) on May 10, 2008 at 13:45 UTC
      Thanks for yr reply. I have installed DBD::myql package; otherwise I wdnt be able to connect from the command line. The problem only occurs on my local web server in Mac OS X 10.5.2. On my other Mac running 10.3 the code runs fine, as it also does on my remote site. Regards, Sarpedon Jones
Re: Mac OS X 10.5.2 web server cannot connect to mysql
by jhourcle (Prior) on May 11, 2008 at 10:09 UTC

    If it works from the command line, and doesn't from Apache, it's most likely an issue with the pathing -- you mention you have two different versions of Perl installed. (5.8 and 5.10) -- can they both see the module from the command line?

    Also, are you using a full path in your shebang line, or just '#!perl' ? If the later, try changing it to a full path, so you know which version of perl it's trying to run. After that, the only thing I can think of is to write a CGI that dumps the contents of '@INC', and make sure the correct include directory is there ... if not, add it with 'use lib'

      Thanks for yr reply. The shebang is ok & the @INC is set up to point at MySQL bin etc. I feel the problem may be w/ Apache2 & MySQL. Regards, Sarpedon Jones