php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22061 file() fails to open a https URL when the site uses a self signed certificate
Submitted: 2003-02-04 17:51 UTC Modified: 2003-02-04 18:06 UTC
From: amith at xalan dot com Assigned:
Status: Not a bug Package: URL related
PHP Version: 4.3.0 OS: Linux Redhat 7.3 - 2.4.18
Private report: No CVE-ID: None
 [2003-02-04 17:51 UTC] amith at xalan dot com
The function file() fails when I try to open a https URL where the site uses a self-signed certificate.

Example:

<?php

$var=file('https://mail.xalan.com');
var_dump($var);

?>

This script fails.  All that gets printed out is

bool(false)

In the apache error logs I get the following message:

[Tue Feb  4 18:10:28 2003] [error] PHP Warning:  file() [<a href='http://www.php.net/function.file'>function.file</a>]: php_hostconnect: connect failed in /usr/local/apache/htdocs/test_ssl.php on line 3
[Tue Feb  4 18:10:28 2003] [error] PHP Warning:  file(https://mail.xalan.com) [<a href='http://www.php.net/function.file'>function.file</a>]: failed to create stream: Connection timed out in /usr/local/apache/htdocs/test_ssl.php on line 3

However, if I substitute the URL with a site that uses a trusted certificate it works fine:

<?php

$var=file('https://www.wachovia.com');
var_dump($var);

?>

 './configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-openssl=/usr/local/ssl' '--with-bz2' '--with-pspell' '--with-db3=/usr/lib' '--enable-ftp' '--with-gd' '--with-imap=/usr/local/imap-2002b' '--with-imap-ssl=/usr/local/imap-2002b' '--with-ldap' '--with-jpeg-dir=/usr/lib' '--with-xpm-dir=/usr/lib' '--with-freetype-dir=/usr/lib' '--enable-sigchild' '--with-gettext' '--with-mcrypt' '--with-xml' '--with-mysql=/usr/local/mysql' '--with-mhash' '--with-zlib' '--with-dom' '--with-dom-xslt' '--with-dom-exslt' '--with-png-dir=/usr/lib' '--enable-mime-magic'

Also my max_execution_time = 90000.  The URL loads in less than 2 seconds when I use my browser.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-04 18:01 UTC] amith at xalan dot com
actually the problem is not with self signed certificates, its when the name on the certificate doesn't match the URL used.  Since this is a security issue, I doubt it will be changed.  I will ask on the mailing list about what the right way to do this is.  This is not a bug
 [2003-02-04 18:06 UTC] sniper@php.net
not bug -> bogus.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC