Jump to content

child pid xxxx exit signal Segmentation fault (11)


mattgleeson

Recommended Posts

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
Link to comment
Share on other sites

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:
[code]
<?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();
}

?>
[/code]
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.