Jump to content

msqli_fetch_row() works fine, but msqli_fetch_array() causes Apache to crash


Recommended Posts

Hi,

 

I have installed Apache 2.2.14, PHP 5.2.12 and MySQL 5.1.41 on Windows Vista. Having encountered the error described below, I tried reinstalling several times, but to no avail.

 

I can retrieve the data I am looking for using msqli_fetch_row(), but if I try to get an array using msqli_fetch_array(), Firefox tells me that the connection was reset and a Windows Alert warns me that "Apache HTTP Server stopped working and was closed."

 

I have trawled the bulletin boards without finding a solution, though I did find a suggestion that it might be a configuration problem.

 

This code works fine:

 

<?
$link = mysqli_connect('localhost','root','[password]','acme');

$select = "SELECT first_name, last_name FROM customers WHERE id=1";
$result = mysqli_query($link, $select);

$row = mysqli_fetch_row($result);

echo "<br/>".$row[0];
echo "<br/>".$row[1];

mysqli_close($link);
?>

 

But the following fails:

 

<?
$link = mysqli_connect('localhost','root','[password]','acme');

$select = "SELECT first_name, last_name FROM customers WHERE id=1";
$result = mysqli_query($link, $select);

$row = mysqli_fetch_row($result);

// Crashes whether I try to display results or not...

mysqli_close($link);
?>

 

Any suggestions much appreciated,

 

Thanks!

 

Link to comment
Share on other sites

Check both the Apache error log and the Windows event log for more information.

 

Problems like this, when they are not due to php bugs (which your problem could be), are usually caused by mismatched versions of files. How did you install php and did you do anything unusual like download additional files to get mysqli to work and/or have a previous version of php installed...

Link to comment
Share on other sites

Thanks!

 

I didn't have to import extensions - I mostly followed the installation instructions given on The Site Wizard (http://www.thesitewizard.com/php/index.shtml). I tried alternative installation methods (including installing Wamp Server 2), but none of them worked out.

 

The event doesn't seem to register in the Firefox Error Console, but on the Apache Error Log it shows up as follows:

 

[sun Dec 27 17:27:45 2009] [notice] Parent: child process exited with status 255 -- Restarting.

httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.1.7 for ServerName

[sun Dec 27 17:27:45 2009] [notice] Apache/2.2.14 (Win32) PHP/5.2.12 configured -- resuming normal operations

[sun Dec 27 17:27:45 2009] [notice] Server built: Sep 28 2009 22:41:08

[sun Dec 27 17:27:45 2009] [notice] Parent: Created child process 6348

httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.1.7 for ServerName

httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.1.7 for ServerName

[sun Dec 27 17:27:45 2009] [notice] Child 6348: Child process is running

[sun Dec 27 17:27:45 2009] [notice] Child 6348: Acquired the start mutex.

[sun Dec 27 17:27:45 2009] [notice] Child 6348: Starting 64 worker threads.

[sun Dec 27 17:27:45 2009] [notice] Child 6348: Starting thread to listen on port 80.

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.