Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 04 Feb 2007 09:36:58 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Terry Todd <tlt@badger.tltodd.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: phpMyAdmin httpd segmentation fault
Message-ID:  <45C5A93A.8010501@infracaninophile.co.uk>
In-Reply-To: <20070203204156.A4743@badger.tltodd.com>
References:  <20070203204156.A4743@badger.tltodd.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig518D4AA77DA82D1F195FAF6E
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable

Terry Todd wrote:
> I installed FreeBSD 6.2-RELEASE, php-5.1.6_3, php5-extensions-1.0,
> mysql-5.0.27 and apache_1.3.37_1.
>=20
> php -i now works Ok after I moved recode.so to the top of the list
> of extensions in extensions.ini.  It took a while to figure that
> one out.  Before that php -i would seg fault and core dump.  It
> took some google searching and using gdb on the core file to fix
> it.
>=20
> A test web page for phpinfo works fine too.  Mysql works OK from
> the command line.
>=20
> However I can't get phpMyAdmin to work.  It seg faults in reading=20
> /usr/local/www/phpMyAdmin/libraries/url_generating.lib.php
> There is no core dump produced.

Hmmm... very strange.  We have just built a RELENG_6_2 server with
apache13-ssl, php5 and phpMyAdmin and no such problems are apparent.

Did you modify the CFLAGS or otherwise change the level of
optimization used by the compiler?

> I ran ktrace httpd -X
>=20
> Then when I try to open the phpMyAdmin/index.php page in a browser
> httpd seg faults.
>=20
> Here is the tail of kdump from the ktrace.out from the above ktrace.
>=20
> ....
>   1372 httpd    CALL  gettimeofday(0xbfbf7158,0)
>   1372 httpd    RET   gettimeofday 0
>   1372 httpd    CALL  lstat(0xbfbf75b0,0xbfbf70f0)
>   1372 httpd    NAMI  "/usr"
>   1372 httpd    RET   lstat 0
>   1372 httpd    CALL  lstat(0xbfbf75b0,0xbfbf70f0)
>   1372 httpd    NAMI  "/usr/local"
>   1372 httpd    RET   lstat 0
>   1372 httpd    CALL  lstat(0xbfbf75b0,0xbfbf70f0)
>   1372 httpd    NAMI  "/usr/local/www"
>   1372 httpd    RET   lstat 0
>   1372 httpd    CALL  lstat(0xbfbf75b0,0xbfbf70f0)
>   1372 httpd    NAMI  "/usr/local/www/phpMyAdmin"
>   1372 httpd    RET   lstat 0
>   1372 httpd    CALL  lstat(0xbfbf75b0,0xbfbf70f0)
>   1372 httpd    NAMI  "/usr/local/www/phpMyAdmin/libraries"
>   1372 httpd    RET   lstat 0
>   1372 httpd    CALL  lstat(0xbfbf75b0,0xbfbf70f0)
>   1372 httpd    NAMI  "/usr/local/www/phpMyAdmin/libraries/url_generati=
ng.lib.php"
>   1372 httpd    RET   lstat 0
>   1372 httpd    CALL  open(0x845eda8,0,0x1b6)
>   1372 httpd    NAMI  "/usr/local/www/phpMyAdmin/libraries/url_generati=
ng.lib.php"
>   1372 httpd    RET   open 4
>   1372 httpd    CALL  fstat(0x4,0x8102748)
>   1372 httpd    RET   fstat 0
>   1372 httpd    CALL  lseek(0x4,0,0,0,0x1)
>   1372 httpd    RET   lseek 0
>   1372 httpd    CALL  read(0x4,0x82e3028,0x2000)
>   1372 httpd    GIO   fd 4 read 4096 bytes
>        "<?php
>         /* $Id: url_generating.lib.php,v 2.12.2.1 2006/09/26 19:23:24 l=
em9 Exp $ */
>         // vim: expandtab sw=3D4 ts=3D4 sts=3D4:
>=20
>=20
>         /**
>          * URL/hidden inputs generating.
>          */
>=20
>=20
>         /**
>          * Generates text with hidden inputs.
>          *
>          * @see     PMA_generate_common_url()
>          * @param   string   optional database name
>          * @param   string   optional table name
>          * @param   int      indenting level
>          *
>          * @return  string   string with input fields
>          *
>          * @global  string   the current language
>          * @global  string   the current conversion charset
>          * @global  string   the current connection collation
>          * @global  string   the current server
>          * @global  array    the configuration array
>          * @global  boolean  whether recoding is allowed or not
>          *
>          *
>          * @access  public
>          *
>          * @author  nijel
>          */
>         function PMA_generate_common_hidden_inputs($db =3D '', $table =3D=
 '', $indent =3D 0, $skip =3D array())
>         {
>             if (is_array($db)) {
>                 $params  =3D& $db;
>                 $_indent =3D empty($table) ? $indent : $table;
>                 $_skip   =3D empty($indent) ? $skip : $indent;
>                 $indent  =3D& $_indent;
>                 $skip    =3D& $_skip;
>             } else {
>                 $params =3D array();
>                 if (isset($db) && strlen($db)) {
>                     $params['db'] =3D $db;
>                 }
>                 if (isset($table) && strlen($table)) {
>                     $params['table'] =3D $table;
>                 }
>             }
>=20
>             if (! empty($GLOBALS['server'])
>             &&  $GLOBALS['server'] !=3D $GLOBALS['cfg']['ServerDefault'=
]) {
>                 $params['server'] =3D $GLOBALS['server'];
>             }
>             if (empty($_COOKIE['pma_lang'])
>             && ! empty($GLOBALS['lang'])) {
>                 $params['lang'] =3D $GLOBALS['lang'];
>             }
>             if (empty($_COOKIE['pma_charset'])
>             && ! empty($GLOBALS['convcharset'])) {
>                 $params['convcharset'] =3D $GLOBALS['convcharset'];
>             }
>             if (empty($_COOKIE['pma_collation_connection'])
>             && ! empty($GLOBALS['collation_connection'])) {
>                 $params['collation_connection'] =3D $GLOBALS['collation=
_connection'];
>             }
>=20
>             $params['token'] =3D $_SESSION[' PMA_token '];
>=20
>             if (! is_array($skip)) {
>                 if (isset($params[$skip])) {
>                     unset($params[$skip]);
>                 }
>             } else {
>                 foreach ($skip as $skipping) {
>                     if (isset($params[$skipping])) {
>                         unset($params[$skipping]);
>                     }
>                 }
>             }
>=20
>             $spaces =3D str_repeat('    ', $indent);
>=20
>             $return =3D '';
>             foreach ($params as $key =3D> $val) {
>                 $return .=3D $spaces . '<input type=3D"hidden" name=3D"=
' . htmlspecialchars($key) . '" value=3D"' . htmlspecialchars(\
>         $val) . '" />' . "\\n";
>             }
>=20
>             return $return;
>         }
>=20
>         /**
>          * Generates text with URL parameters.
>          *
>          * <code>
>          * // note the ?
>          * echo 'script.php?' . PMA_generate_common_url('mysql', 'right=
s');
>          * // produces with cookies enabled:
>          * // script.php?db=3Dmysql&amp;table=3Drights
>          * // with cookies disabled:
>          * // script.php?server=3D1&amp;lang=3Den-utf-8&amp;db=3Dmysql&=
amp;table=3Drights
>          *
>          * $params['myparam'] =3D 'myvalue';
>          * $params['db']      =3D 'mysql';
>          * $params['table']   =3D 'rights';
>          * // note the missing ?
>          * echo 'script.php' . PMA_generate_common_url($params);
>          * // produces with cookies enabled:
>          * // script.php?myparam=3Dmyvalue&amp;db=3Dmysql&amp;table=3Dr=
ights
>          * // with cookies disabled:
>          * // script.php?server=3D1&amp;lang=3Den-utf-8&amp;myparam=3Dm=
yvalue&amp;db=3Dmysql&amp;table=3Drights
>          *
>          * // note the missing ?
>          * echo 'script.php' . PMA_generate_common_url();
>          * // produces with cookies enabled:
>          * // script.php
>          * // with cookies disabled:
>          * // script.php?server=3D1&amp;lang=3Den-utf-8
>          * </code>
>          *
>          * @param   mixed    assoc. array with url params or optional s=
tring with database name
>          *                   if first param is an array there is also a=
n ? prefixed to the url
>          * @param   string   optional table name only if first param is=
 array
>          * @param   string   character to use instead of '&amp;' for de=
viding
>          *                   multiple URL parameters from each other
>          *
>          * @return  string   string with URL parameters
>          *
>          * @global  string   the current language
>          * @global  string   the current conversion charset
>          * @global  string   the current connection collation
>          * @global  string   the current server
>          * @global  arra"
>   1372 httpd    RET   read 6467/0x1943
>   1372 httpd    CALL  read(0x4,0x82e3028,0x2000)
>   1372 httpd    GIO   fd 4 read 0 bytes
>        ""
>   1372 httpd    RET   read 0
>   1372 httpd    CALL  read(0x4,0x82e3028,0x2000)
>   1372 httpd    GIO   fd 4 read 0 bytes
>        ""
>   1372 httpd    RET   read 0
>   1372 httpd    CALL  close(0x4)
>   1372 httpd    RET   close 0
>   1372 httpd    PSIG  SIGSEGV SIG_DFL
>=20
>=20
> I moved url_generating.lib.php to url_generating.lib.php.sav and
> copied url_generating.lib.php.sav to a new url_generating.lib.php.
> Same thing happens.
>=20
> I tried the latest phpMyAdmin-2.9.2 and it does the exact same thing.
>=20
> It always seg faults in the exact same place in the exact same way.
>=20
> /var/log/messages file gets:
> Feb  3 16:07:38 testbox kernel: pid 8512 (httpd), uid 80: exited on sig=
nal 11

Hmmm... a SEGV in apache or one of it's loaded modules should result
in a core file in the cwd of the apache process. The general way to
switch that behaviour off is by using the limits(1) command to set
coredumpsize=3D0 -- and you can use /etc/login.conf to set limits for
a whole class of users.  If the apache startup scripts
are running eg:

    eval `limits -e -C daemon`

or similar that might be the cause.  However, the default settings
are 'coredumpsize=3Dunlimited' for all, and I guess you'ld know if you'ld=

changed any of that sort of thing.

Hmmm... cwd for the Apache process is set to the root directory, like
all good daemons should.  You can see that by:

   fstat -p `cat /var/run/httpd.pid`

For very obvious security reasons, the root directory should not
be writable by daemon processes with network listeners (and conversely,
daemons should never be run as root or any other UID with write access,
well, anywhere much).  In this case, however, and strictly for testing
purposes, so long as it's on a machine not accessible from the Internet,
temporarily making the root dir writable by the apache process could help=

get you a core file to analyse.

> /var/log/httpd-errors gets:
> [Sat Feb  3 16:07:39 2007] [notice] child pid 8512 exit signal Segmenta=
tion fault (11)
>=20
> I am out of ideas on what to try next.  Anyone else have any suggestion=
s?

Can you try unmounting and fsck'ing the partition (fsck -f /dev/adXsYz)
where url_generating.lib.php lives?

Given that the error you are seeing is so repeatable, it is unlikely
to be a hardware fault, but it may be worth running a cycle or two
of memtest86 to see if it picks up anything.

Otherwise the only thing I can think to try is the rather blunt approach
of recompiling/reinstalling the phpMyAdmin port and everything it depends=

on:

    portupgrade -Rfi phpMyAdmin







--=20
Dr Matthew J Seaman MA, D.Phil.                       7 Priory Courtyard
                                                      Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey         Ramsgate
                                                      Kent, CT11 9PW


--------------enig518D4AA77DA82D1F195FAF6E
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.2 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFxalB8Mjk52CukIwRCLeBAJ4jYDN14zL9MQ0UjUTJTAXgVG5L4QCfTXmO
dvokczC1HD2rTte3jl7OcL4=
=qpAd
-----END PGP SIGNATURE-----

--------------enig518D4AA77DA82D1F195FAF6E--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45C5A93A.8010501>