php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62527 curl localhost return false
Submitted: 2012-07-11 06:21 UTC Modified: 2012-07-11 07:32 UTC
From: 290762903 at qq dot com Assigned:
Status: Not a bug Package: Windows Installer
PHP Version: 5.3.14 OS: windows7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: 290762903 at qq dot com
New email:
PHP Version: OS:

 

 [2012-07-11 06:21 UTC] 290762903 at qq dot com
Description:
------------
the devlop env :
windows7 x64
nginx 1.2.2 for windows
php5.3.6 MSVC9 (Visual C++ 2008)
-------------------------------------------
1.php script below "Test script"

when $url is 'http://www.baidu.com/' , it return source baidu.com .
when $url is 'http://localhost/2.php' , it return false! the script of 2.php 
only is:<?php echo time();?>

i thought localhost php-cgi has problem, but when i run http://localhost/1.php 
from another pc,and $url set be 'http://192.168.1.200/2.php' , it return 
1339022206 the true time. (192.168.1.200 is my ipaddress) .

i have no idea to see, when i use apache and php, no problem,but nginx has it.


Test script:
---------------
$url = 'http://www.baidu.com';
$curlHandle = curl_init();
curl_setopt( $curlHandle , CURLOPT_URL , $url ); 
curl_setopt( $curlHandle , CURLOPT_RETURNTRANSFER , true ); 
curl_setopt( $curlHandle , CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $curlHandle , CURLOPT_TIMEOUT, 10 ); 
curl_setopt( $curlHandle , CURLOPT_FRESH_CONNECT ,true); 
var_dump( curl_exec($curlHandle) );
curl_close($curlHandle);

Expected result:
----------------
the devlop env :
windows7 x64
nginx 1.2.2 for windows
php5.3.6 MSVC9 (Visual C++ 2008)
-------------------------------------------
1.php script below "Test script"

when $url is 'http://www.baidu.com/' , it return source baidu.com .
when $url is 'http://localhost/2.php' , it return false! the script of 2.php 
only is:<?php echo time();?>

i thought localhost php-cgi has problem, but when i run http://localhost/1.php 
from another pc,and $url set be 'http://192.168.1.200/2.php' , it return 
1339022206 the true time. (192.168.1.200 is my ipaddress) .

i have no idea to see, when i use apache and php, no problem,but nginx has it.



Patches

5.3.6 (last revision 2012-07-11 06:22 UTC by 290762903 at qq dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-11 07:32 UTC] laruence@php.net
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 http://www.php.net/support.php 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.

(seems you are a chinese, judged from your mail address)
检查你的system32/drivers/etc/hosts, 看看你的localhost alias到什么ip, 然后看看你的nginx监
听的是什么address

这个不属于PHP的问题, 应该是你hosts的问题.
 [2012-07-11 07:32 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 23:01:28 2024 UTC