Apache crashes every time I call mysqli_fetch_assoc()

Apache crashes every time I call mysqli_fetch_assoc()

am 09.07.2008 19:32:23 von Bonger O

------=_Part_2677_2793835.1215624743576
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

I have set up an environment on my Vista laptop comprising of Apache 2.2,
MySQL Server 5.1 and Php 5.2.5.

I'm using a simple php program that I found in a PHP/SQL book. The PHP
program queries a MySQL table and traverses the results array of the query
and should display on screen. However, there seems to be a problem with my
environment and as every time I run the program I get the error "*Apache
HTTP server stopped working and was closed*".

Below is the code I am using, but I have managed to narrow the problem down
to *$row = mysqli_fetch_assoc($result);*
For some reason this is causing the crash. Would there be any reason that
this function cant be found perhaps? I really have no clue!!!


> > /* Program: petDisplay.php
> * Desc: Displays all pets in selected category.
> */
> ?>
>
> Pet Catalog
>
> >
> $user="root";
> $host="localhost";
> $password="PASSWORD";
> $database = "am";
> $cxn = mysqli_connect($host,$user,$password,$database)
> or die ("couldn't connect to server");
> $pettype = "horse"; //horse was typed in a form by user
> $query = "SELECT * FROM Pet WHERE petType='$pettype'";
> $result = mysqli_query($cxn,$query)
> or die ("Couldn't execute query.");
>
> /*Display results in a table */
> $pettype = ucfirst($pettype)."s";
>
> echo "

$pettype

";
> echo "";
> echo "";
> while($row = mysqli_fetch_assoc($result))
> {
> extract($row);
>
> $f_price = number_format($price,2);
> echo "\n
> \n
> \n
> \n
> \n";
> echo "\n";
> }
> echo "

$petName$petDescription\$$f_price

\n";
> ?>
>



Also, please see messages I have copied from the Apache error log:


> [Wed Jul 09 19:30:09 2008] [notice] Parent: child process exited with
> status 3221225477 -- Restarting.
> [Wed Jul 09 19:30:12 2008] [notice] Apache/2.2.6 (Win32) PHP/5.2.5
> configured -- resuming normal operations
> [Wed Jul 09 19:30:12 2008] [notice] Server built: Sep 5 2007 08:58:56
> [Wed Jul 09 19:30:12 2008] [notice] Parent: Created child process 4936
> [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Child process is running
> [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Acquired the start mutex.
> [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Starting 250 worker
> threads.
> [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Starting thread to listen
> on port 80.



Any help would be much apprecieted.

Thanks,
Bonger

------=_Part_2677_2793835.1215624743576--

Re: Apache crashes every time I call mysqli_fetch_assoc()

am 09.07.2008 20:02:03 von Bastien Koert

------=_Part_2987_12985960.1215626524943
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Wed, Jul 9, 2008 at 1:32 PM, Bonger O wrote:

> Hi,
>
> I have set up an environment on my Vista laptop comprising of Apache 2.2,
> MySQL Server 5.1 and Php 5.2.5.
>
> I'm using a simple php program that I found in a PHP/SQL book. The PHP
> program queries a MySQL table and traverses the results array of the query
> and should display on screen. However, there seems to be a problem with my
> environment and as every time I run the program I get the error "*Apache
> HTTP server stopped working and was closed*".
>
> Below is the code I am using, but I have managed to narrow the problem down
> to *$row = mysqli_fetch_assoc($result);*
> For some reason this is causing the crash. Would there be any reason that
> this function cant be found perhaps? I really have no clue!!!
>
>
> > > > /* Program: petDisplay.php
> > * Desc: Displays all pets in selected category.
> > */
> > ?>
> >
> > Pet Catalog
> >
> > > >
> > $user="root";
> > $host="localhost";
> > $password="PASSWORD";
> > $database = "am";
> > $cxn = mysqli_connect($host,$user,$password,$database)
> > or die ("couldn't connect to server");
> > $pettype = "horse"; //horse was typed in a form by user
> > $query = "SELECT * FROM Pet WHERE petType='$pettype'";
> > $result = mysqli_query($cxn,$query)
> > or die ("Couldn't execute query.");
> >
> > /*Display results in a table */
> > $pettype = ucfirst($pettype)."s";
> >
> > echo "

$pettype

";
> > echo "";
> > echo "";
> > while($row = mysqli_fetch_assoc($result))
> > {
> > extract($row);
> >
> > $f_price = number_format($price,2);
> > echo "\n
> > \n
> > \n
> > \n
> > \n";
> > echo "\n";
> > }
> > echo "

$petName$petDescription\$$f_price

\n";
> > ?>
> >
>
>
>
> Also, please see messages I have copied from the Apache error log:
>
>
> > [Wed Jul 09 19:30:09 2008] [notice] Parent: child process exited with
> > status 3221225477 -- Restarting.
> > [Wed Jul 09 19:30:12 2008] [notice] Apache/2.2.6 (Win32) PHP/5.2.5
> > configured -- resuming normal operations
> > [Wed Jul 09 19:30:12 2008] [notice] Server built: Sep 5 2007 08:58:56
> > [Wed Jul 09 19:30:12 2008] [notice] Parent: Created child process 4936
> > [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Child process is running
> > [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Acquired the start mutex.
> > [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Starting 250 worker
> > threads.
> > [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Starting thread to listen
> > on port 80.
>
>
>
> Any help would be much apprecieted.
>
> Thanks,
> Bonger
>

Have you checked that mysqli is compiled into PHP?

--

Bastien

Cat, the other other white meat

------=_Part_2987_12985960.1215626524943--

Re: Apache crashes every time I call mysqli_fetch_assoc()

am 09.07.2008 21:23:34 von Bonger O

------=_Part_4177_33005978.1215631414621
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Thanks for the reply Bastien.

How do you mean compiled into PHP? I have *extension=php_mysqli.dll* enabled
in my *php.ini* file. Is that what you mean?

I'm pretty sure it's intalled ok as I don't have any problems with other
mysqli functions.

On Wed, Jul 9, 2008 at 8:02 PM, Bastien Koert wrote:

>
>
> On Wed, Jul 9, 2008 at 1:32 PM, Bonger O wrote:
>
>> Hi,
>>
>> I have set up an environment on my Vista laptop comprising of Apache 2.2,
>> MySQL Server 5.1 and Php 5.2.5.
>>
>> I'm using a simple php program that I found in a PHP/SQL book. The PHP
>> program queries a MySQL table and traverses the results array of the query
>> and should display on screen. However, there seems to be a problem with my
>> environment and as every time I run the program I get the error "*Apache
>> HTTP server stopped working and was closed*".
>>
>> Below is the code I am using, but I have managed to narrow the problem
>> down
>> to *$row = mysqli_fetch_assoc($result);*
>> For some reason this is causing the crash. Would there be any reason that
>> this function cant be found perhaps? I really have no clue!!!
>>
>>
>> > >> > /* Program: petDisplay.php
>> > * Desc: Displays all pets in selected category.
>> > */
>> > ?>
>> >
>> > Pet Catalog
>> >
>> > >> >
>> > $user="root";
>> > $host="localhost";
>> > $password="PASSWORD";
>> > $database = "am";
>> > $cxn = mysqli_connect($host,$user,$password,$database)
>> > or die ("couldn't connect to server");
>> > $pettype = "horse"; //horse was typed in a form by user
>> > $query = "SELECT * FROM Pet WHERE petType='$pettype'";
>> > $result = mysqli_query($cxn,$query)
>> > or die ("Couldn't execute query.");
>> >
>> > /*Display results in a table */
>> > $pettype = ucfirst($pettype)."s";
>> >
>> > echo "

$pettype

";
>> > echo "";
>> > echo "";
>> > while($row = mysqli_fetch_assoc($result))
>> > {
>> > extract($row);
>> >
>> > $f_price = number_format($price,2);
>> > echo "\n
>> > \n
>> > \n
>> > \n
>> > \n";
>> > echo "\n";
>> > }
>> > echo "

$petName$petDescription\$$f_price

\n";
>> > ?>
>> >
>>
>>
>>
>> Also, please see messages I have copied from the Apache error log:
>>
>>
>> > [Wed Jul 09 19:30:09 2008] [notice] Parent: child process exited with
>> > status 3221225477 -- Restarting.
>> > [Wed Jul 09 19:30:12 2008] [notice] Apache/2.2.6 (Win32) PHP/5.2.5
>> > configured -- resuming normal operations
>> > [Wed Jul 09 19:30:12 2008] [notice] Server built: Sep 5 2007 08:58:56
>> > [Wed Jul 09 19:30:12 2008] [notice] Parent: Created child process 4936
>> > [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Child process is running
>> > [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Acquired the start
>> mutex.
>> > [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Starting 250 worker
>> > threads.
>> > [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Starting thread to
>> listen
>> > on port 80.
>>
>>
>>
>> Any help would be much apprecieted.
>>
>> Thanks,
>> Bonger
>>
>
> Have you checked that mysqli is compiled into PHP?
>
> --
>
> Bastien
>
> Cat, the other other white meat

------=_Part_4177_33005978.1215631414621--

Re: Apache crashes every time I call mysqli_fetch_assoc()

am 10.07.2008 02:24:50 von dmagick

Bonger O wrote:
> Hi,
>
> I have set up an environment on my Vista laptop comprising of Apache 2.2,
> MySQL Server 5.1 and Php 5.2.5.
>
> I'm using a simple php program that I found in a PHP/SQL book. The PHP
> program queries a MySQL table and traverses the results array of the query
> and should display on screen. However, there seems to be a problem with my
> environment and as every time I run the program I get the error "*Apache
> HTTP server stopped working and was closed*".
>
> Below is the code I am using, but I have managed to narrow the problem down
> to *$row = mysqli_fetch_assoc($result);*
> For some reason this is causing the crash. Would there be any reason that
> this function cant be found perhaps? I really have no clue!!!

If the function doesn't exist php gives that error, not a random crash.

Does the query work outside of php (type it in to the mysql console
directly) ?

Does it happen for a particular record? ie it gets up to record #5
before it crashes. What's in record #5?

How many records are returned by the query? Maybe you're selecting too
much data and the srever is killing it because it's taking too much
memory (random guess :P).

Do you have another environment you can try it in?
What happens there when you:
- use the same database
- use a different database

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Apache crashes every time I call mysqli_fetch_assoc()

am 10.07.2008 08:57:54 von Evert Lammerts

Check out your system's logs / event viewer. If apache crashes (how do
you notice?) there should be some indication of the reason.

Evert

On Thu, Jul 10, 2008 at 2:24 AM, Chris wrote:
> Bonger O wrote:
>> Hi,
>>
>> I have set up an environment on my Vista laptop comprising of Apache 2.2,
>> MySQL Server 5.1 and Php 5.2.5.
>>
>> I'm using a simple php program that I found in a PHP/SQL book. The PHP
>> program queries a MySQL table and traverses the results array of the query
>> and should display on screen. However, there seems to be a problem with my
>> environment and as every time I run the program I get the error "*Apache
>> HTTP server stopped working and was closed*".
>>
>> Below is the code I am using, but I have managed to narrow the problem down
>> to *$row = mysqli_fetch_assoc($result);*
>> For some reason this is causing the crash. Would there be any reason that
>> this function cant be found perhaps? I really have no clue!!!
>
> If the function doesn't exist php gives that error, not a random crash.
>
> Does the query work outside of php (type it in to the mysql console
> directly) ?
>
> Does it happen for a particular record? ie it gets up to record #5
> before it crashes. What's in record #5?
>
> How many records are returned by the query? Maybe you're selecting too
> much data and the srever is killing it because it's taking too much
> memory (random guess :P).
>
> Do you have another environment you can try it in?
> What happens there when you:
> - use the same database
> - use a different database
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Apache crashes every time I call mysqli_fetch_assoc()

am 14.07.2008 20:57:46 von Oskar

-------- Original Message --------
Subject: [PHP-DB] Apache crashes every time I call mysqli_fetch_assoc()
From: Bonger O
To: php-db@lists.php.net
Date: 9.7.2008 19:32
> Hi,
>
> I have set up an environment on my Vista laptop comprising of Apache 2.2,
> MySQL Server 5.1 and Php 5.2.5.
>
> I'm using a simple php program that I found in a PHP/SQL book. The PHP
> program queries a MySQL table and traverses the results array of the query
> and should display on screen. However, there seems to be a problem with my
> environment and as every time I run the program I get the error "*Apache
> HTTP server stopped working and was closed*".
>
> Below is the code I am using, but I have managed to narrow the problem down
> to *$row = mysqli_fetch_assoc($result);*
> For some reason this is causing the crash. Would there be any reason that
> this function cant be found perhaps? I really have no clue!!!
>
>
>
I had similar problem running Apache 2.2, MySQL 5.1 and PHP 5.2.6. - I
had crash everytime I tried to connect to MySQL. When I executed the
script with php.exe it worked okay so I think there is some error in
php5apache2_2.dll. I played with various versions of PHP and Apache but
the error remained, entries in event log were still the same:
Application Failure Apache.exe 2.0.63.2 in php5ts.dll 5.2.6.6 at offset
0000abda
Application Failure httpd.exe 2.2.9.0 in php5ts.dll 5.2.7.7 at offset
0000abda

I havent found any solution (there are few bug reports on php.net) but
they were closed because the bug was not "reproducable". I downgraded to
MySQL 5.0 and everything works fine now.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Apache crashes every time I call mysqli_fetch_assoc()

am 17.07.2008 12:05:33 von Bonger O

------=_Part_1461_19063835.1216289133735
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Thanks for the reply Chris.

The query does work when I type it into the mysql console. But it wouldn't
be a size issue because the table I am querying is tiny. There is only four
records in it.

This happens for any query that I enter whenever I use the
mysqli_fetch_assoc() function.

Thanks again!


On 7/10/08, Chris wrote:
>
> Bonger O wrote:
> > Hi,
> >
> > I have set up an environment on my Vista laptop comprising of Apache 2.2,
> > MySQL Server 5.1 and Php 5.2.5.
> >
> > I'm using a simple php program that I found in a PHP/SQL book. The PHP
> > program queries a MySQL table and traverses the results array of the
> query
> > and should display on screen. However, there seems to be a problem with
> my
> > environment and as every time I run the program I get the error "*Apache
> > HTTP server stopped working and was closed*".
> >
> > Below is the code I am using, but I have managed to narrow the problem
> down
> > to *$row = mysqli_fetch_assoc($result);*
> > For some reason this is causing the crash. Would there be any reason that
> > this function cant be found perhaps? I really have no clue!!!
>
> If the function doesn't exist php gives that error, not a random crash.
>
> Does the query work outside of php (type it in to the mysql console
> directly) ?
>
> Does it happen for a particular record? ie it gets up to record #5
> before it crashes. What's in record #5?
>
> How many records are returned by the query? Maybe you're selecting too
> much data and the srever is killing it because it's taking too much
> memory (random guess :P).
>
> Do you have another environment you can try it in?
> What happens there when you:
> - use the same database
> - use a different database
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>

------=_Part_1461_19063835.1216289133735--

Re: Apache crashes every time I call mysqli_fetch_assoc()

am 17.07.2008 12:07:24 von Bonger O

------=_Part_1490_11204320.1216289244794
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Thanks for the reply Evert.

I checked the Apache log and found:


> [Wed Jul 09 19:30:09 2008] [notice] Parent: child process exited with
> status 3221225477 -- Restarting.
> [Wed Jul 09 19:30:12 2008] [notice] Apache/2.2.6 (Win32) PHP/5.2.5
> configured -- resuming normal operations
> [Wed Jul 09 19:30:12 2008] [notice] Server built: Sep 5 2007 08:58:56
> [Wed Jul 09 19:30:12 2008] [notice] Parent: Created child process 4936
> [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Child process is running
> [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Acquired the start mutex.
> [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Starting 250 worker
> threads.
> [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Starting thread to listen
> on port 80.

Are there any other logs I should check?

Thanks!



On 7/10/08, Evert Lammerts wrote:
>
> Check out your system's logs / event viewer. If apache crashes (how do
> you notice?) there should be some indication of the reason.
>
> Evert
>
> On Thu, Jul 10, 2008 at 2:24 AM, Chris wrote:
> > Bonger O wrote:
> >> Hi,
> >>
> >> I have set up an environment on my Vista laptop comprising of Apache
> 2.2,
> >> MySQL Server 5.1 and Php 5.2.5.
> >>
> >> I'm using a simple php program that I found in a PHP/SQL book. The PHP
> >> program queries a MySQL table and traverses the results array of the
> query
> >> and should display on screen. However, there seems to be a problem with
> my
> >> environment and as every time I run the program I get the error "*Apache
> >> HTTP server stopped working and was closed*".
> >>
> >> Below is the code I am using, but I have managed to narrow the problem
> down
> >> to *$row = mysqli_fetch_assoc($result);*
> >> For some reason this is causing the crash. Would there be any reason
> that
> >> this function cant be found perhaps? I really have no clue!!!
> >
> > If the function doesn't exist php gives that error, not a random crash.
> >
> > Does the query work outside of php (type it in to the mysql console
> > directly) ?
> >
> > Does it happen for a particular record? ie it gets up to record #5
> > before it crashes. What's in record #5?
> >
> > How many records are returned by the query? Maybe you're selecting too
> > much data and the srever is killing it because it's taking too much
> > memory (random guess :P).
> >
> > Do you have another environment you can try it in?
> > What happens there when you:
> > - use the same database
> > - use a different database
> >
> > --
> > Postgresql & php tutorials
> > http://www.designmagick.com/
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

------=_Part_1490_11204320.1216289244794--