You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Pierre Vaudrey <pi...@wanadoo.fr> on 2002/08/16 16:52:49 UTC

Simple Database connect

I'm running mod_perl & MySQL on a Mac OSX machine with the following 
information at the start of the Apache server :
[Fri Aug 16 10:38:41 2002] [alert] httpd: Could not determine the 
server's fully qualified domain name, using 127.0.0.1 for ServerName
[Fri Aug 16 10:38:41 2002] [notice] Apache/1.3.26 (Darwin) PHP/4.2.2 
mod_perl/1.26 configured -- resuming normal operations
[Fri Aug 16 10:38:41 2002] [notice] Accept mutex: flock (Default: flock)
I'm trying to interface the hereafter described database with the 
following script :
The error is at the end : could you help me to fix it (Perhaps I've made 
a mistake in installing manually the DBI package which is probably 
inside of  /usr/libexec/httpd/libphp4.so)
#!/usr/bin/perl

# load module
use DBI();

# connect
my $dbh = DBI->connect("DBI:mysql:database=jobs;host=localhost", "root",
"", {'RaiseError' => 1});

# execute query
my $sth = $dbh->prepare("SELECT * FROM location");
$sth->execute();

         # iterate through resultset
         while(my $ref = $sth->fetchrow_hashref())
         {
         print "ID: $ref->{'id'}\nLocation: $ref->{'location'}\n\n";
         }

# clean up
$dbh->disconnect();

Database Description :
mysql> show tables;
+----------------+
| Tables_in_jobs |
+----------------+
| country        |
| degree         |
| department     |
| industry       |
| listing        |
| location       |
| r_education    |
| r_employment   |
| r_reference    |
| r_skill        |
| r_user         |
| salary         |
| subject        |
+----------------+
13 rows in set (0.00 sec)

mysql> select * from location;
+----+----------+
| id | location |
+----+----------+
|  1 | New York |
|  2 | London   |
|  3 | Paris    |
|  4 | Tokyo    |
|  5 | Bombay   |
+----+----------+
5 rows in set (0.48 sec)

Error from error_log file :
dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec
/usr/libexec/httpd/libphp4.so definition of __dig_vec
/Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec
dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec
/usr/libexec/httpd/libphp4.so definition of __dig_vec
/Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec
[Fri Aug 16 16:28:24 2002] [error] (22)Invalid argument: getsockname


Pierre Vaudrey
email pierre.vaudrey@wanadoo.fr


Re: Simple Database connect

Posted by Pierre Vaudrey <pi...@wanadoo.fr>.
Le vendredi 16 août 2002, à 07:17 PM, Stas Bekman a écrit :

> David Wheeler wrote:
>> On Friday, August 16, 2002, at 07:52  AM, Pierre Vaudrey wrote:
>>> dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec
>>> /usr/libexec/httpd/libphp4.so definition of __dig_vec
>>> /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of 
>>> __dig_vec
>>> dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec
>>> /usr/libexec/httpd/libphp4.so definition of __dig_vec
>>> /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of 
>>> __dig_vec
>> It looks as though you have some symbol conflicts between PHP and 
>> MySQL. Try turning off libphp.so. If that works, you may need to 
>> recompile PHP and/or MySQL.
>>
>

I've disabled PHP in httpd.conf and I can print the table : thanks for 
the tip !!
> most likely this:
> http://perl.apache.org/docs/1.0/guide/troubleshooting.html#_exit_signal_Segmentation_fault__11___with_mysql

I will do if I need in parallel PHP & mod_perl
>
> And this:
> [Fri Aug 16 10:38:41 2002] [alert] httpd: Could not determine the 
> server's fully qualified domain name, using 127.0.0.1 for ServerName
>
> is amended by adding:
>
> 127.0.0.1               localhost.localdomain localhost
>
> to /etc/hosts

I'll change the hosts file thanks.

>
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>
>
Pierre Vaudrey
174 rue de Lyon
01800 Bourg Saint Christophe
tel 0474 61 1167
mobile 0675 61 5902
email pierre.vaudrey@wanadoo.fr


Re: Simple Database connect

Posted by Stas Bekman <st...@stason.org>.
David Wheeler wrote:
> On Friday, August 16, 2002, at 07:52  AM, Pierre Vaudrey wrote:
> 
>> dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec
>> /usr/libexec/httpd/libphp4.so definition of __dig_vec
>> /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec
>> dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec
>> /usr/libexec/httpd/libphp4.so definition of __dig_vec
>> /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec
> 
> 
> It looks as though you have some symbol conflicts between PHP and MySQL. 
> Try turning off libphp.so. If that works, you may need to recompile PHP 
> and/or MySQL.

most likely this:
http://perl.apache.org/docs/1.0/guide/troubleshooting.html#_exit_signal_Segmentation_fault__11___with_mysql

And this:
[Fri Aug 16 10:38:41 2002] [alert] httpd: Could not determine the 
server's fully qualified domain name, using 127.0.0.1 for ServerName

is amended by adding:

127.0.0.1               localhost.localdomain localhost

to /etc/hosts

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Simple Database connect

Posted by David Wheeler <da...@wheeler.net>.
On Friday, August 16, 2002, at 07:52  AM, Pierre Vaudrey wrote:

> dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec
> /usr/libexec/httpd/libphp4.so definition of __dig_vec
> /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec
> dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec
> /usr/libexec/httpd/libphp4.so definition of __dig_vec
> /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec

It looks as though you have some symbol conflicts between PHP and MySQL. 
Try turning off libphp.so. If that works, you may need to recompile PHP 
and/or MySQL.

HTH,

David

--
David Wheeler                                     AIM: dwTheory
david@wheeler.net                                 ICQ: 15726394
http://david.wheeler.net/                      Yahoo!: dew7e
                                                Jabber: Theory@jabber.org