By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,723 Members | 1,298 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,723 IT Pros & Developers. It's quick & easy.

using fopen with PUT method - failing to open resource

P: 1
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("PUTDATA = $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_fopen" 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?
Aug 16 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.