php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13425 invalid page fault in module PHP4TS.DLL
Submitted: 2001-09-24 21:33 UTC Modified: 2002-02-04 02:19 UTC
From: thunder2 at home dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 4.0.6 OS: Windows 98 SE
Private report: No CVE-ID: None
 [2001-09-24 21:33 UTC] thunder2 at home dot com
Hello,

I'm running PHP 4.0.6 and Apache 1.3.19 localhost on Windows 98,
with the latest Zend Optimizer 1.1.0 (PHP 4.0.6 compatible).

PHPBuilder has an article on: Storing Binary Data with PHP/MySQL
(http://phpbuilder.com/columns/florian19991014.php3)

The scripts:

1) Create a new database on your SQL Server:

CREATE TABLE binary_data (
id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,
description CHAR(50),
bin_data LONGBLOB,
filename CHAR(50),
filesize CHAR(50),
filetype CHAR(50)
); 

2) A sample php script you can use to store data in your database:

   store.php

<?php

// store.php - by Florian Dittmer <dittmer@gmx.net>
// Example php script to demonstrate the storing of binary files into
// an sql database. More information can be found at http://www.phpbuilder.com/
?>

<HTML>
<HEAD><TITLE>Store binary data into SQL Database</TITLE></HEAD>
<BODY>

<?php
// code that will be executed if the form has been submitted:

if ($submit) {

    // connect to the database
    // (you may have to adjust the hostname,username or password)

    MYSQL_CONNECT("localhost","root","password");
    mysql_select_db("binary_data");

    $data = addslashes(fread(fopen($form_data, "rb"), filesize($form_data)));

    $result=MYSQL_QUERY("INSERT INTO binary_data (description,bin_data,filename,filesize,filetype) ".
        "VALUES ('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')");

    $id= mysql_insert_id();
    print "<p>This file has the following Database ID: <b>$id</b>";

    MYSQL_CLOSE();

} else {

    // else show the form to submit new data:
?>

    <form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
    File Description:<br>
    <input type="text" name="form_description"  size="40">
    <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
    <br>File to upload/store in database:<br>
    <input type="file" name="form_data"  size="40">
    <p><input type="submit" name="submit" value="submit">
    </form>

<?php

}

?>

</BODY>
</HTML>


3) A sample php script with which you can access the stored data  

   getdata.php

<?php

// getdata.php - by Florian Dittmer <dittmer@gmx.net>
// Example php script to demonstrate the direct passing of binary data
// to the user. More infos at http://www.phpbuilder.com
// Syntax: getdata.php?id=<id>

if($id) {

    // you may have to modify login information for your database server:
    @MYSQL_CONNECT("localhost","root","password");

    @mysql_select_db("binary_data");

    $query = "select bin_data,filetype from binary_data where id=$id";
    $result = @MYSQL_QUERY($query);

    $data = @MYSQL_RESULT($result,0,"bin_data");
    $type = @MYSQL_RESULT($result,0,"filetype");

    Header( "Content-type: $type");
    echo $data;

};
?> 

As the script needs to "know" which file is requested, you have to add the ID as a parameter. 
Example: A file has been stored with ID 2 in the database. To get this file, you have to call: 

   getdata.php?id=2 

-------------------------------------------------------------------------

OK, the scripts work GREAT, but here is where I have a problem:

1) I go into phpMyAdmin (Version 2.2.0)
2) Select my database
3) BROWSE the table - binary_data
4) Select EDIT on one of the items within the table...


APACHE caused an invalid page fault in
module PHP4TS.DLL at 0177:00a3861b.
Registers:
EAX=00730ef8 CS=0177 EIP=00a3861b EFLGS=00010202
EBX=00736d74 SS=017f ESP=01a6f960 EBP=007bb270
ECX=00001980 DS=017f ESI=00000000 FS=61a7
EDX=25303025 ES=017f EDI=00000001 GS=0000
Bytes at CS:EIP:
8b 0a 89 88 34 2c 00 00 eb 18 6a 10 e8 54 2c fe
Stack dump:
01a6fe5c 007bb270 01a6fde4 007a3990 051a73f4 0080b7cc 00000002 051a6fdc
051a700c 00000000 00000000 01a6fbcc 007c9b81 00000009 00000000 01a6f9dc

APACHE caused an invalid page fault in
module PHP4TS.DLL at 0177:00a1b434.
Registers:
EAX=43254335 CS=0177 EIP=00a1b434 EFLGS=00010246
EBX=00736d74 SS=017f ESP=0194f944 EBP=007bb270
ECX=25364525 DS=017f ESI=007d5b20 FS=603f
EDX=45442545 ES=017f EDI=00730ef8 GS=0000
Bytes at CS:EIP:
89 02 8b 06 85 c0 74 06 8b 4e 04 89 48 04 56 ff
Stack dump:
051a6eec 007d5b30 00a1ff84 007d5b30 007f8ab0 00a33f22 00738534 0194fe5c
007bb270 0194fde4 007a3990 051a6ecc 008160ec 007f8ab0 051a6bbc 051a6bec

Oddly enough, even though I get these 2 warning (or errors),
Apache does NOT crash... I can continue to browse other
databases in phpMyAdmin, and Apache continues to serve web pages?

Any idea what might be causing this?

Steve

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-04 02:19 UTC] yohgaki@php.net
The version of PHP that this bug was reported in is too old. Please
try to reproduce this bug in the latest version of PHP (available
from http://www.php.net/downloads.php

If you are still able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 11:01:30 2024 UTC