Jump to content


Photo

child pid xxxx exit signal Segmentation fault (11)


  • Please log in to reply
5 replies to this topic

#1 mattgleeson

mattgleeson
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 24 August 2006 - 02:16 PM

I am moving my site from development on a windows box to test on a linux box. MySQL and PHP were both installed already on Linux, both running version 5.x

I am having trouble talking to the database now. I use the mysqli library to talk to the database.

Even though I have set the display_errors = on and error reporting to all, I dont receive any errors and instead just get the default 'cannot find server - cannot display page'. Without any errors to go off im really struggling to figure out what the problem is.
It seems to be with the prepare statement call. Any idea why this would fail? Is there a setting in MySQL or the php.ini needed for the prepare statement to work.

Below is my test code that is failing: when it tries to prepare the statement it fails, gives no php error and gives me 'cannot find server' page:
$dbConn1 = new mysqli("localhost", "user", "password", "db");
$stmt = $dbConn1->stmt_init();
$stmt->prepare("select * from table"); <-fails here

I have been going around in circles for a day now, any help or ideas would be appreciated.

Thanks

#2 -Mike-

-Mike-
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 24 August 2006 - 03:18 PM

Are you sure about the location of the error?
Seeing as connection simply returns a false if not successful, have you checked whether it actually has a connection for you to execute a query upon, or just trusting that it's all okay?

From the manual:
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");

/* check connection */ 
if (mysqli_connect_errno()) {
   printf("Connect failed: %s\n", mysqli_connect_error());
   exit();
}

?>


#3 mattgleeson

mattgleeson
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 24 August 2006 - 08:39 PM

Thanks for your reply.
I have put the check in like you said but there is no error returned and if I do a echo $dbConn1->stat() i get the following which tells me it can connect fine to the DB:
Uptime: 386706 Threads: 1 Questions: 5126 Slow queries: 1 Opens: 128 Flush tables: 1 Open tables: 59 Queries per second avg: 0.013

printr($stmt) after initialising it it says:
object
which is what it is supposed to return. So the problem seems to lie with the prepare statement. The fact that the prepare doesn't return false (Or anything) but instead crashes the page makes me suspect there is something else going on such as somethiing with mysql not being configured correctly etc.
Does anybody have any details on what prepare() actually does  / what it needs to work? Does it need a specific version of mysql?
Is there any kind of database/mysql logs I can check?

Thanks again

#4 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 24 August 2006 - 11:53 PM

From http://www.php.net/mysqli

In order to have these functions available, you must compile PHP with support for the mysqli extension.


Are you sure that your host has the mysqli functions?

#5 mattgleeson

mattgleeson
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 25 August 2006 - 07:34 AM

I've checked the extension exists in my /etc/php.d/ directory. I've also checked it appears in the phpinfo output (see below).

mysqli:
Client API library version  3.23.58 
Client API header version  5.0.22 
MYSQLI_SOCKET  /var/lib/mysql/mysql.sock 

Directive Local Value Master Value
mysqli.default_host no value no value
mysqli.default_port 3306 3306
mysqli.default_pw no value no value
mysqli.default_socket no value no value
mysqli.default_user no value no value
mysqli.max_links Unlimited Unlimited
mysqli.reconnect Off Off

Because it can connect to the database using the mysqli_connect function means that it must be using the mysqli extension. Is there any DB connection logs I can check?
Im using the standard mysql module in another application on the same server and that works fine talking to the database. Just seems to be isolated to the statement prepare command with the mysqli library. FYI -  i didn't actually install php on the server. I think it had version 4.x on it already when i first got access to the server and i ran the php 5.14 rpms. Im quite new to installing/configuring php on Linux so maybe I haven't configured something correctly?

#6 mattgleeson

mattgleeson
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 25 August 2006 - 01:10 PM

ok I found this error in the apache error_log:
child pid xxxx exit signal Segmentation fault (11)

Just trying to resreach the net and see what I can find. It must have something to do with conflicting libraries. If anyone has experience with this error....




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users