You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Andreas Krüger <an...@kruger.nu> on 2005/03/31 18:23:33 UTC
Segmentation Fault
Hello there,
I've just installed Apache 2.0.53 with Mod-Perl 2.
I'm trying to write a virtual host system in Perl but I get this error upon
starting Apache.
Starting web server: Apache2/usr/sbin/apache2ctl: line 99: 2799
Segmentation fault $HTTPD -k start -DSSL
Setup:
------
Apache/2.0.52 (Debian GNU/Linux)
PHP/5.0.3
mod_perl/1.999.21
Perl/v5.6.1
Installed relevant packages:
----------------------------
libdbd-mysql-perl
libgdbi-dev
libdbi-perl
Httpd.conf:
-----------
LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so
PerlModule Apache2
Line which crashes the machine:
-------------------------------
my $dbh = DBI->connect("dbi:mysql:$db:$host", "$db_user", "$db_password");
Script:
-------
<Perl>
use DBI;
# Declare and initialize variables
my $host = 'localhost';
my $db = 'domains';
my $db_user = 'apache';
my $db_password = 'password';
my $server_admin = 'some@email.com';
# Connect to the requested server
my $dbh = DBI->connect("dbi:mysql:$db:$host", "$db_user", "$db_password");
my $sth = $dbh->prepare("SELECT domain, docroot FROM vhosts ORDER BY domain
ASC");
$sth->execute();
while (($domain, $docroot) = $sth->fetchrow_array()) {
system("/bin/mkdir -p $docroot");
system("/bin/mkdir -p $docroot/logs/");
push @{$VirtualHost{'*'}}, {
ServerName => "$domain",
ServerAlias => "www.$domain $domain",
ServerAdmin => "$server_admin",
DocumentRoot => "$docroot",
ErrorLog => "$docroot/error.log",
CustomLog => ["$docroot/access.log", "combined"],
};
}
</Perl>
If I out comment this script totally, the server runs fine with mod_perl.
Best Regards,
Andreas
Re: Segmentation Fault
Posted by Dan Wilga <dw...@MtHolyoke.edu>.
Just in case you haven't yet solved the problem, I wanted to let you
know that I had a similar problem.
It turns out that MySQL and mod_perl were linking to different
versions of libdb (BerkeleyDB). The solution was to rebuild mod_php
and mod_perl with the same version. Apache itself can also have yet
another version linked.
A good tool to help figure out this sort of thing is "ldd". Give it
the full paths of the modules and httpd itself, then see if there are
differing versions anywhere.
--
Dan Wilga dwilga@mtholyoke.edu
Web Administrator http://www.mtholyoke.edu
Mount Holyoke College Tel: 413-538-3027
South Hadley, MA 01075 "Who left the cake out in the rain?"
Re: Segmentation Fault
Posted by Rodger Castle <ro...@profocusdesigns.com>.
>
> > I am unaware of a fix, but PHP/MySQL is your problem. There's apparently
> > a SQL library collision between PHP and DBI.
>
> >Rodger
>
> There shouldn't be. It works fine in apache 1.* with mod_perl and php. Same
> is, that it works in Debian Testing with Apache2 and mod_perl. But that_s in
> testing, and I want to run stable.
>
> Andreas
>
Well, I didn't say it made sense, but you'll find that if you take out the DBI code in mod_perl or take out the php module, everything is fine. I can't find the list posts where this problem is mentioned, but the PHP and DBI libraries don't like each other. I had this problem on a Debian Sarge system. My resultion was to simply not use PHP as I was transitioning out of PHP anyway.
Rodger
Re: Segmentation Fault
Posted by Andreas Krüger <an...@kruger.nu>.
>> I've just installed Apache 2.0.53 with Mod-Perl 2.
>>
>> I'm trying to write a virtual host system in Perl but I get this error
upon
>> starting Apache.
>>
>> Starting web server: Apache2/usr/sbin/apache2ctl: line 99: 2799
>> Segmentation fault $HTTPD -k start -DSSL
>>
>>
>> Setup:
>> ------
>> Apache/2.0.52 (Debian GNU/Linux)
>> PHP/5.0.3
>> mod_perl/1.999.21
>> Perl/v5.6.1
>>
>> Installed relevant packages:
>> ----------------------------
>> libdbd-mysql-perl
>> libgdbi-dev
>> libdbi-perl
> I am unaware of a fix, but PHP/MySQL is your problem. There's apparently
> a SQL library collision between PHP and DBI.
>Rodger
There shouldn't be. It works fine in apache 1.* with mod_perl and php. Same
is, that it works in Debian Testing with Apache2 and mod_perl. But thats in
testing, and I want to run stable.
Andreas
Re: Segmentation Fault
Posted by Rodger Castle <ro...@profocusdesigns.com>.
> I've just installed Apache 2.0.53 with Mod-Perl 2.
>
> I'm trying to write a virtual host system in Perl but I get this error upon
> starting Apache.
>
> Starting web server: Apache2/usr/sbin/apache2ctl: line 99: 2799
> Segmentation fault $HTTPD -k start -DSSL
>
>
> Setup:
> ------
> Apache/2.0.52 (Debian GNU/Linux)
> PHP/5.0.3
> mod_perl/1.999.21
> Perl/v5.6.1
>
> Installed relevant packages:
> ----------------------------
> libdbd-mysql-perl
> libgdbi-dev
> libdbi-perl
I am unaware of a fix, but PHP/MySQL is your problem. There's apparently a SQL library collision between PHP and DBI.
Rodger
Re: Segmentation Fault
Posted by Rodger Castle <ro...@profocusdesigns.com>.
> >> All you need to do is rebuild php.
> >
> > Ehm, in what way?
> >
> > So, I first need to build mod_perl, THEN build php?
...
>
> cd PHP
> ./configure --with-apxs2=/usr/local/apache2/bin/apxs
> --with-config-file-path=/usr/local/lib/php4.3.9.ini --with-mysql
> make
> make install
> cp php.ini-dist /usr/local/lib/php4.3.9.ini
>
...
Andreas,
As I understand it (I'm sure someone will correct me if I'm wrong), you'll need to rebuild PHP using the libraries from the MySQL source distribution and not PHP's built-in routines. I believe this is done with --with-mysql=[DIR] where DIR is the MySQL base directory.
Rodger
Re: Segmentation Fault
Posted by jonathan vanasco <jv...@mastersofbranding.com>.
On Apr 1, 2005, at 9:39 AM, Andreas Krüger wrote:
>> All you need to do is rebuild php.
>
> Ehm, in what way?
>
> So, I first need to build mod_perl, THEN build php?
This is my build order notepad that i refer to when updating. It
should help.
download:
apache2 - httpd.apache.org
berkeleydb - sleepycat.org
libapreq2 - httpd.apache.org
mod_perl2 - perl.apache.org
php 4.x - php.net
subversion - subversion.tigris.org
cd APACHE2
./configure prefix=/usr/local/apache2 --with-mpm=prefork --enable-dav
--enable-so --enable-deflate --enable-maintainer-mode --with-dbm=db4
--with-berkeley-db=/usr/local/BerkeleyDB.4.2
make
sudo make install
cd SUBVERSION
./configure --with-apr=/usr/local/apache2
--with-apr-util=/usr/local/apache2
cd MOD_PERL_2
perl Makefile.PL MP_INST_APACHE2=1 MP_APXS=/usr/local/apache2/bin/apxs
make
make test
sudo make install
cd LIBAPREQ2
perl Makefile.PL --with-apache2-apxs=/usr/local/apache2/bin/apxs
make
make test
sudo make install
cd PHP
./configure --with-apxs2=/usr/local/apache2/bin/apxs
--with-config-file-path=/usr/local/lib/php4.3.9.ini --with-mysql
make
make install
cp php.ini-dist /usr/local/lib/php4.3.9.ini
edit httpd.conf
LoadModule php4_module libexec/libphp4.so
AddType application/x-httpd-php .php .phtml
RE: Segmentation Fault
Posted by Andreas Krüger <an...@kruger.nu>.
>All you need to do is rebuild php.
Ehm, in what way?
So, I first need to build mod_perl, THEN build php?
Re: Segmentation Fault
Posted by Jonathan Vanasco <jv...@mastersofbranding.com>.
All you need to do is rebuild php.
On Mar 31, 2005, at 4:26 PM, Rodger Castle wrote:
> I had no success with this fix, however. Not that I tried very hard.
> I've been getting irritated with PHP lately anyway.
Re: Segmentation Fault
Posted by Rodger Castle <ro...@profocusdesigns.com>.
>
> http://perl.apache.org/docs/1.0/guide/
> troubleshooting.html#_exit_signal_Segmentation_fault__11___with_mysql
> http://perl.apache.org/docs/2.0/user/troubleshooting/
> troubleshooting.html#Segmentation_Fault_when_Using_DBI
>
Ah, yes, that's the one. Thank you.
I had no success with this fix, however. Not that I tried very hard. I've been getting irritated with PHP lately anyway.
Rodger
Re: Segmentation Fault
Posted by Jonathan Vanasco <jv...@mastersofbranding.com>.
http://perl.apache.org/docs/1.0/guide/
troubleshooting.html#_exit_signal_Segmentation_fault__11___with_mysql
http://perl.apache.org/docs/2.0/user/troubleshooting/
troubleshooting.html#Segmentation_Fault_when_Using_DBI