ID: 29667 Comment by: alatar_ at mail dot ru Reported By: yrob at mail dot crpower dot com Status: Open Bug Type: MySQL related Operating System: Linux 2.6.5-7.104-default PHP Version: 5.0.1 New Comment:
PHP crash with "exit signal Segmentation fault (11)" when I try mysqli->query For example this script doesn`t work <?php $db_host = "127.0.0.1"; $db_user = "test"; $db_pass = "test123"; $db_name = "test"; $db = new mysqli($db_host, $db_user, $db_pass, $db_name); $num = $db->query("SELECT uid FROM test WHERE flag = 'TRUE'")->num_rows; echo "$num flags<br>"; $db->close(); echo "ok<br>"; ?> But this script is work <?php $db_host = "127.0.0.1"; $db_user = "test"; $db_pass = "test123"; $db_name = "test"; $db = mysqli_connect($db_host, $db_user, $db_pass, $db_name); $res = mysqli_query($db, "SELECT uid FROM test WHERE flag = 'TRUE'"); $num = mysqli_num_rows($res); echo "$num flags<br>"; echo "ok<br>"; ?> I`m using php 5.0.1, mysql 4.1.3-beta, FreeBSD 5.1 Previous Comments: ------------------------------------------------------------------------ [2004-08-15 01:13:08] ghostfacekillaz at gmx dot net Description: ------------ I'm using MySQL 4.1.3-beta For me the mysqli functions work. There's just a different behavior I found between PHP 5.0.0 and PHP 5.0.1 in function mysqli_fetch_array Example: -------- SQL-Statement: SHOW TABLES FROM databasename mysqli_fetch_array (PHP 5.0.0) returns: [0] = tablename mysqli_fetch_array (PHP 5.0.1) returns: [Tables_in_databasename] = tablename ------------------------------------------------------------------------ [2004-08-14 00:26:27] yrob at mail dot crpower dot com Description: ------------ I'm using MySQL 5.0.1. The main problem here is that now the mysqli functions don't work. Configuration, make, and make install run just fine. When I try to load a web page, nothing displays (displayed just fine using PHP 5.0.0). When I use the CLI on PHP 5.0.1 to test the web page, it seems to run just fine. Had to go back to PHP 5.0.0 so my mysqli functions will work. The other problem is that I wasn't able to get mysql functions to work at all. It wouldn't even pass configuration "--with-mysql=/usr/lib/mysql". Configuration said it couldn't find libmysql, though I pointed it directly to the MySQL 5.0.1 library directory. Reproduce code: --------------- $db = new mysqli( 'dbhost', 'username', 'pw'); if (!$db) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $db->select_db("dbname"); $sql = "SELECT * FROM test"; $select = $db->query( $sql ); $result = $select->fetch_array(MYSQLI_BOTH); $something = $result['something']; Expected result: ---------------- Loaded web page. Actual result: -------------- Web page does not load, but the CLI runs just fine. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29667&edit=1