[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problems with PHP4 & MySQL Packages



Le lun 23/06/2003 à 06:53, Eric Pretorious a écrit : 
> Hello, All:
> 
> I'm stumped: I'm using Debian 3.0 (Woody) on a PowerBook Lombard and can't 
> get the PHP package  (php4 4.1.2-6 and php4-mysql 4.1.2-6) and the MySQL 
> package (mysql-server 3.23.49-8) to play nicely together. This script...
> 
> <?php
> $connect = mysql_pconnect('localhost','sample_user','sample_passwd');
> mysql_select_db('sample_db',$connect);
> $sql = 'SELECT * FROM names WHERE userid = ' . $somenumber;
> $result = mysql_query($sql, $connect);
> 
> var_dump($row);
> ?>
> 
> ...causes apache to die. (i.e., nothing is returned to the browser.) 
> /var/log/apache/error.log contains "[notice] child pid [#####] exit signal 
> Segmentation fault (11)" for _every_ active apache child process where ##### 
> is the pid for the apache process.
> 
> Why is this happening?

var_dump is boggus on this version.
Use a workaround :
<?php
// (c) jean-christophe michel 2002

function my_var_export($v, $ret=false) {
if (is_null($v)) return 'null';
$res = '';
if (is_array($v)) {
$res = ' array(';
$virg = '';
foreach ($v as $_k => $_v) {
$res .= $virg.my_var_export($_k, true).' => '.my_var_export($_v, true);
$virg = ",\n"; 
}
$res .= ')';
} elseif (is_string($v)) {
$res = "'".str_replace("'","\'",$v)."'";
        } elseif (is_bool($v)) {
$res = ($v)?'true':'false';
        } else {
    $res = $v;
}

if ($ret) {
            return $res;
        } else {
            echo $res;
        }
    }
?>



-- 

Jean-Christophe Michel <jc.michel@symetrie.com>

Symétrie



Reply to: