On Tue, 14 Aug 2001 13:45, Chris Cameron wrote:
> I was told this was a PHP problem, and to submit a bug report. I'm not
> too sure what such a bug report would look like, or even if this is a
> PHP problem.
>
> Below is the message I sent to an Apache list, could someone tell me
> whether my problem is crummy code, or an actual problem with
> PHP/Apache?
>
> Thanks
> Chris
>
> -----Original Message-----
> From: Chris Cameron [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 10, 2001 12:40 PM
> To: [EMAIL PROTECTED]
> Subject: PHP Script causing recursive free() calls (?)
>
>
> I've got quite a problem with part of a PHP script I wrote causing
> Apache too fill up it's error logs with:
> httpd in free(): warning: chunk is already free.
> httpd in free(): warning: chunk is already free.
> httpd in malloc(): warning: recursive call.
> FATAL: emalloc(): Unable to allocate 256 bytes
>
> Each call of this script will put about 20 megs in my error log.
> My Apache setup is:
> Apache/1.3.20 (Unix)
> mod_ssl/2.8.4
> OpenSSL/0.9.6b
> PHP/4.0.6
>
> And my phpinfo page is at chris.upnix.com/index.php
>
> The part of my PHP script that's causing the problem (sorry about the
> wraping):
> /* If no errors, submit junk to database */
> if(!isset($Error)) {
> for($i = 1; $i <= $Days; $i++) {
> /* Write to bookings first */
> $QueryString = "INSERT INTO bookings VALUES(nextval('BID'),
> '$CompanyID', '" . $TimeSpan[$i] . "', '$TimeF', '$TimeT',
> '$PricePerUnit')";
> $Query = pg_exec($Connect, $QueryString);
> $OID = pg_getlastoid($Query);
> /* Find the BID we were given */
> $QueryString = "SELECT bid FROM bookings WHERE oid = '" . $OID . "'";
> $Query = pg_exec($Connect, $QueryString);
> $Result = pg_fetch_array($Query, 0);
> $BID = $Result['bid'];
> /* Go through our therapists */
> foreach($Therapists[$i] as $Key => $TherapistID) {
> $QueryString = "INSERT INTO bookedtherapist VALUES('" . $BID .
>"',
> '$TherapistID', '$TimeF', '$TimeT')";
> pg_exec($Connect, $QueryString);
> }
> }
> /* Everything Should be done, send us off to schview.php */
> header("Location: " . $BaseURL . "admin/schview.php");
> exit;
> }
>
>
> I've tried rewriting little parts of this script, but haven't had any
> luck in stopping the errors. Also, I've recompiled everything twice
> now, which also didn't help. Any help would be appreciated.
>
> Thanks,
> Chris
This comes from someone who has no experience with Postgres, but I
suspect that you may be getting into trouble inside your for and foreach
loops where you do apossibly huge number of inserts without freeing used
result pointers. Try doing a pg_free_result after each insert and see if
that helps.
For reporting PHP bugs, try www.php.net and follow the link 'reporting
bugs' at the top right :-)
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Fact is solidified opinion
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]