From owner-freebsd-questions@FreeBSD.ORG Sun Feb 4 09:37:40 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 029C216A406 for ; Sun, 4 Feb 2007 09:37:40 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (ns0.infracaninophile.co.uk [81.187.76.162]) by mx1.freebsd.org (Postfix) with ESMTP id 1BE2313C461 for ; Sun, 4 Feb 2007 09:37:38 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from [IPv6:::1] (localhost.infracaninophile.co.uk [IPv6:::1]) by smtp.infracaninophile.co.uk (8.13.8/8.13.8) with ESMTP id l149b532007818; Sun, 4 Feb 2007 09:37:08 GMT (envelope-from m.seaman@infracaninophile.co.uk) Message-ID: <45C5A93A.8010501@infracaninophile.co.uk> Date: Sun, 04 Feb 2007 09:36:58 +0000 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 1.5.0.9 (X11/20070120) MIME-Version: 1.0 To: Terry Todd References: <20070203204156.A4743@badger.tltodd.com> In-Reply-To: <20070203204156.A4743@badger.tltodd.com> X-Enigmail-Version: 0.94.0.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig518D4AA77DA82D1F195FAF6E" X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (smtp.infracaninophile.co.uk [IPv6:::1]); Sun, 04 Feb 2007 09:37:23 +0000 (GMT) X-Virus-Scanned: ClamAV 0.88.7/2522/Sat Feb 3 16:30:44 2007 on happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, DKIM_POLICY_TESTING,NO_RELAYS autolearn=ham version=3.1.7 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on happy-idiot-talk.infracaninophile.co.uk Cc: freebsd-questions@freebsd.org Subject: Re: phpMyAdmin httpd segmentation fault X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Feb 2007 09:37:40 -0000 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 > " /* $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 . ' $val) . '" />' . "\\n"; > } >=20 > return $return; > } >=20 > /** > * Generates text with URL parameters. > * > * > * // note the ? > * echo 'script.php?' . PMA_generate_common_url('mysql', 'right= s'); > * // produces with cookies enabled: > * // script.php?db=3Dmysql&table=3Drights > * // with cookies disabled: > * // script.php?server=3D1&lang=3Den-utf-8&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&db=3Dmysql&table=3Dr= ights > * // with cookies disabled: > * // script.php?server=3D1&lang=3Den-utf-8&myparam=3Dm= yvalue&db=3Dmysql&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&lang=3Den-utf-8 > * > * > * @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 '&' 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--