using fopen with PUT method - failing to open resource

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • filmo
    New Member
    • Aug 2006
    • 1

    using fopen with PUT method - failing to open resource

    I've got a script that is receiving a PUT request from a Java Applet.

    To access the PUT data, the php script contains:

    [php]
    $putdata = fopen("php://input","r");
    error_log("PUTD ATA = $putdata Last Err: $php_errormsg") ;[/php]

    On our development server, it works fine (Mac OS X 10.3.9 with PHP 4.3.6)

    On our production server (Linux with Ensim CP & PHP 4.2.2), the resource isn't being created.

    On the develoment server, when it works correctly the error_log contains:
    [Tue Aug 15 14:34:41 2006] [error] PUTDATA = Resource id #24 Last Err:
    [Tue Aug 15 14:34:48 2006] [error] PUTDATA = Resource id #24 Last Err:
    [Tue Aug 15 14:34:52 2006] [error] PUTDATA = Resource id #24 Last Err:

    Which is what I expected, $put_date is a resource, and $php_errormsg is NULL. The script executes correctly and the file being sent via the PUT is received by the server.

    On the production server, the error log is:
    [Tue Aug 15 14:33:11 2006] [error] PHP Warning: No content-type in POST request in Unknown on line 0
    [Tue Aug 15 14:33:12 2006] [error] PHP Warning: fopen("php://input", "r") - Success in /home/virtual/site4/fst/var/www/html/clientarea/slice.php on line 190
    [Tue Aug 15 14:33:12 2006] [error] PUTDATA = Last Err: fopen("php://input", "r") - Success

    The first two errors are from the built in Error Reporting, the last one is my user error_log. In this example, you can see that $putdata is now NULL, and $php_errormsg is now a mysterious "fopen("php ://input", "r") - Success". (I really don't understand a message that says 'success' when in fact it's failing... :confused: )

    As near as I can tell, I have the two php.ini files set pretty similar given that they're slightly different versions of PHP.

    Also, I've confirmed that "allow_url_fope n" is ON in both config files, so that's not the problem.

    I've also tried reading in binary mode:
    $putdata = fopen("php://input","rb");
    With equally poor results.

    Any thoughts?
Working...