|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41852 proxy_login / proxy_pass ignored
Submitted: 2007-06-29 09:17 UTC Modified: 2007-07-02 16:04 UTC
From: bug-php at misc dot lka dot org dot lu Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.2.3 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
35 - 22 = ?
Subscribe to this entry?

 [2007-06-29 09:17 UTC] bug-php at misc dot lka dot org dot lu
When fopen'ing a web page, and using a proxy in the stream context, there is no way to specify proxy username and password

N.B. non-authenticating proxies work just fine.

Reproduce code:
$opts = array('http' =>
	  'proxy' => 'tcp://localhost:2001/',
	  'request_fulluri' => True,
	  'proxy_login' => 'fest1',
	  'proxy_password' => 'xxx'
$context  = stream_context_create($opts);
$fp=fopen("", "r", false, $context)
  or die("Cannot load\n");
print "fp=$fp";
while(!feof($fp)) {
  print $in;

Expected result:
It should display the page from

Actual result:
It logs an error:
[Fri Jun 29 11:06:21 2007] [error] [client ::1] PHP Warning:  fopen( [<a href='function.fopen'>function.fopen</a>]: failed to open stream: HTTP request failed! HTTP/1.0 407 Proxy Authentication Required\r\n in /home/aknaff/public_html/php-test/download.php on line 14

and this even though login and password are correct.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-02 16:04 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

The proxy authentication is generally done by sending the 
Proxy-Authorization header which you can add using the generic headers 
streams context option. Alternatively if authentication is done via HTTP 
Auth, you can do login@password in the URL.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 22 06:01:31 2024 UTC