You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Dustin D." <du...@gmail.com> on 2007/07/20 07:50:11 UTC

php/mod_perl + mysql woes

I can't seem to get php 5.2.3, mod_perl 2.0.3, mysql 5.0.45, and apache
2.2.4 to work together.  I've read countless websites and documentation,
followed all the different hints and tips, and I either end up with a
situation where mysql or php complain about mysql problems, or, if I install
php with the --with-mysql=/usr/local/mysql-5.0.45 option, I get the
following error when I restart apache:

[Thu Jul 19 23:23:47 2007] [notice] SIGHUP received.  Attempting to restart
[Thu Jul 19 23:23:47 2007] [notice] Digest: generating secret for digest
authentication ...
[Thu Jul 19 23:23:47 2007] [notice] Digest: done
[Thu Jul 19 23:23:48 2007] [notice] Apache/2.2.4 (Unix) DAV/2 PHP/5.2.3
mod_perl/2.0.3 Perl/v5.8.5 configured -- resuming normal operations
*** glibc detected *** malloc(): memory corruption: 0x0000000000be58f0 ***
*** glibc detected *** malloc(): memory corruption: 0x0000000000be58f0 ***
*** glibc detected *** malloc(): memory corruption: 0x0000000000be58f0 ***
*** glibc detected *** malloc(): memory corruption: 0x0000000000be58f0 ***
*** glibc detected *** malloc(): memory corruption: 0x0000000000be58f0 ***
[Thu Jul 19 23:23:49 2007] [notice] child pid 27006 exit signal Aborted (6)
[Thu Jul 19 23:23:49 2007] [notice] child pid 27007 exit signal Aborted (6)
[Thu Jul 19 23:23:49 2007] [notice] child pid 27008 exit signal Aborted (6)
[Thu Jul 19 23:23:49 2007] [notice] child pid 27009 exit signal Aborted (6)
[Thu Jul 19 23:23:49 2007] [notice] child pid 27010 exit signal Aborted (6)
*** glibc detected *** malloc(): memory corruption: 0x0000000000be58f0 ***

FYI, I Iinstalled apache 2.2.4 and then mod_perl 2.0.3.  After installing
mod_perl, everything was working fine, minus the PHP support I need.

So, next, I tackled the php installation, using php 5.2.3 and the following
configuration line:

./configure --with-apxs2=/usr/local/apache2.2.4/bin/apxs
--prefix=/usr/local/apache2.2.4/php
--with-config-file-path=/usr/local/apache2.2.4/php
--enable-force-cgi-redirect --disable-cgi --with-zlib  --with-gettext
--with-mysql=/usr/local/mysql-5.0.45

This installed cleanly, but then I get the errors listed above.

Both PHP and mod_perl are being installed as DSO.  Should I be installing
one or the other as static?

If I exclude the --with-mysql statement from php, then between php and
mod_perl, whoever is listed first with the LoadModule line in httpd.conf is
able to use mysql, while the other complains with mysql errors (unable to
make connections).  I know there are issues with mysql working with both php
and mod_perl, and supposedly they're fixed by installing php with the
--with-mysql option.  I've followed those directions to the T and now I get
these annoying glibc/child pid abort errors.

I searched through the archives of the mailing list fairly extensively, and
couldn't find anything.  I also couldn't find anything online.

Can someone help?  I've been going for the past three evenings trying to get
this to work, and I'm exhausted and defeated.

Thanks,
Dustin

Re: php/mod_perl + mysql woes

Posted by "Dustin D." <du...@gmail.com>.
On 7/20/07, Clinton Gormley <cl...@traveljury.com> wrote:
>
> I've managed to get php5.2.2, mod_perl 2.0.3, apache 2.2.4 and mysql
> 5.0.27 working on openSuSE 10.2 x86_64.


Your install options don't look much different than mine.  I think my
problem might be glibc, since I'm getting glibc and malloc() errors.  But I
really don't want to go into reinstalling glibc and risking having other
things break.  I can run php by itself just fine, and mysql by itself just
fine.  It's only when I mix the two in the same httpd.conf that I encounter
major issues.

For now I'm gonna go the proxy route I think, but would certainly prefer the
one server solution for production.

Also, Jon, I knew I would get that kind of response when I said I was doing
prod and dev on the same server... :)  I should fix that, I agree, and would
make my life much simpler.

Re: php/mod_perl + mysql woes

Posted by Clinton Gormley <cl...@traveljury.com>.
I've managed to get php5.2.2, mod_perl 2.0.3, apache 2.2.4 and mysql
5.0.27 working on openSuSE 10.2 x86_64.

In summary:
 - I install these MySQL packages:
        MySQL-server-standard-5.0.27-0.rhel4.x86_64.rpm
        MySQL-client-standard-5.0.27-0.rhel4.x86_64.rpm
        MySQL-devel-standard-5.0.27-0.rhel4.x86_64.rpm
        MySQL-shared-standard-5.0.27-0.rhel4.x86_64.rpm

 - Apache is configured with nothing special, eg:

        ./configure --prefix=/opt/$APACHE$SUFFIX \
                    --with-mpm=$MPM\
                    --enable-deflate=shared
                    --with-dbm=db4 \
                    --with-berkeley-db=/usr

 - mod_perl is configured as:
        perl Makefile.PL \
              MP_AP_PREFIX=/opt/$APACHE$SUFFIX \
              MP_COMPAT_1X=0 
        
 - php is configured as:

        ./configure \
            --with-apxs2=/opt/$APACHE$SUFFIX/bin/apxs \
            --with-config-file-path=/opt/apache/conf \
            --with-layout=GNU \
          ......
            --with-mysql=shared,/usr/bin/mysql_config \
          ......

Works for me.

good luck - installing PHP is a bitch :)

Clint


Re: php/mod_perl + mysql woes

Posted by Jonathan Vanasco <jv...@2xlp.com>.
On Jul 20, 2007, at 8:44 AM, Michael Peters wrote:

> For some reason, some people are hesitant
> to run multiple versions of apache on the same machine, but there  
> are lots of
> people who do it all the time and it works out just fine.
>
> If you're concerned about running 3 apaches (1 for mod_perl, 1 for  
> PHP and 1 for
> the proxy) then you can use a smaller lightweight proxy like squid.

off the top  of my head, there were a lot of  library conflicts  
between mp and php regarding mysql at some point.  the fix was to  
compile everything from source.  it has to deal with the way the   
distros were bundling php/mysql onto apache.  that could easily be  
your problem.

you can also just run 1 version of apache w/3 config files ...

you should never run php & mod_perl on the same server for content  
generation (  if you're doing auth/filltering, thats another story ).  
they have completely different designs regarding memory use and  
application flow.  you're wasting a ton of resources doing it like that.

i know i advocate this ad-nauseum, but its fucking fast and simple to  
set up:

	port 80: nginx
	port 8000-9000: whatever mod_perl stuff you want, either by port or  
vhost on a single port
	php: run via fast-cgi through nginx

you don't need to do php in apache.  you're likely better off getting  
php out of apache : if you're running both dso's loaded into a  
server, its competing against mod_perl for resources ( children , max  
requests cause respawns, etc ) ; if you split out into multiple  
servers, you're dealing with the apache overhead.  you can just  
forget apache and run php without it.  it works.  it works really  
really well.



Re: php/mod_perl + mysql woes

Posted by "C. Jon Larsen" <jl...@richweb.com>.
> I don't necessarily have a problem running 3 different apaches.  One issue I
> have is that I also need a development environment,

Stop, and setup a sep. box or vserver. I cant imagine doing development on 
the same server env. that is in production will meet with approval from 
your client(s) or boss(es) ?  Save your sanity :)



Re: php/mod_perl + mysql woes

Posted by Michael Peters <mp...@plusthree.com>.
Dustin D. wrote:
> With that in mind, is it possible to reuse the same apache install
> directory, and just launch the different processes with different
> httpd.conf files that load the appropriate DSO's and settings? 

Absolutely. This is what I normally do. There's no reason to have the same
binary code lying around in different places. All you have to do is maintain
separate config files. And if your OS is smart about it might even COW share the
memory between the different apaches.

> Everything I've read about multiple apache servers implies you need
> completely different install trees, which is sorta painful when you need
> 5 different apaches running with practically the same install, just a
> different httpd.conf to load the right DSO.

That should work. I haven't done it with PHP, but I have done it for
apache/mod_perl.

-- 
Michael Peters
Developer
Plus Three, LP


Re: php/mod_perl + mysql woes

Posted by "Dustin D." <du...@gmail.com>.
On 7/20/07, Michael Peters <mp...@plusthree.com> wrote:
>
> Dustin D. wrote:
> > I can't seem to get php 5.2.3, mod_perl 2.0.3, mysql 5.0.45, and apache
> > 2.2.4 to work together.
>
> Why do you need to do that? Normally what I've seen others do in this
> situation
> (and have done myself) is to have 2 separate apaches and a proxy in front
> of
> them to send it to one or the other.


I don't necessarily have a problem running 3 different apaches.  One issue I
have is that I also need a development environment, so that's two more
apache processes as well.  When I was using regular cgi, I only had one
server for everything, development and production, since I was making
minimal code changes and testing out under a virtual server.  Now I might be
looking at 5 different servers because of the need for differences between
dev and production due to different @INC settings, etc., and also the need
for php and mod_perl to be on their own server.  I guess I can live with
that.

With that in mind, is it possible to reuse the same apache install
directory, and just launch the different processes with different
httpd.conffiles that load the appropriate DSO's and settings?
Everything I've read
about multiple apache servers implies you need completely different install
trees, which is sorta painful when you need 5 different apaches running with
practically the same install, just a different httpd.conf to load the right
DSO.

Thanks for the help.

-Dustin

Re: php/mod_perl + mysql woes

Posted by Michael Peters <mp...@plusthree.com>.
Dustin D. wrote:
> I can't seem to get php 5.2.3, mod_perl 2.0.3, mysql 5.0.45, and apache
> 2.2.4 to work together. 

Why do you need to do that? Normally what I've seen others do in this situation
(and have done myself) is to have 2 separate apaches and a proxy in front of
them to send it to one or the other. For some reason, some people are hesitant
to run multiple versions of apache on the same machine, but there are lots of
people who do it all the time and it works out just fine.

If you're concerned about running 3 apaches (1 for mod_perl, 1 for PHP and 1 for
the proxy) then you can use a smaller lightweight proxy like squid.

-- 
Michael Peters
Developer
Plus Three, LP