PHP 5 Unable to Open HTTP Request Stream with fopen or fsockopen Functions PHP 5中無法打開HTTP請求流與fopen或fsockopen職能

With Apache/2.xx or Apache/2.2.x webserver, with PHP5 as the scripting module, a HTTP communication error may occur within the PHP scripts that are parsing and running via the web server.與apache/2.xx或apache/2.2.x的網絡服務器,與php5作為腳本模塊, HTTP通信錯誤,可能會出現內部的PHP腳本是剖析和運行通過網絡服務器。

The errors that generated by PHP include:錯誤所產生的PHP的包括:

PHP Warning: fopen(http://www.example.com): failed to open stream: HTTP request failed! PHP的警告: fopen ( http://www.example.com ) :未能打開流: HTTP請求失敗!
fsockopen(): unable to connect to … fsockopen ( ) :無法連接到…
file_get_contents(): failed to open stream: HTTP request failed! file_get_contents ( ) :未能打開流: HTTP請求失敗!
PHP Warning: main(): Failed opening ‘http://www.example.com/index.html’ for inclusion … PHP的警告:主( ) :未能開放' http://www.example.com/index.html '列入…
PHP Warning: include(/usr/local/index.php): failed to open stream: No such file or directory in … PHP的警告:包括( / usr / local /下的index.php ) :未能打開流:沒有這樣的文件或目錄在…

To resolve the problem, ensure that allow_url_fopen is enabled in PHP.INI configuration file.要解決這個問題,確保allow_url_fopen啟用在php.ini配置文件中。 The line should look like this:線看起來應該是這樣的:

allow_url_fopen = On allow_url_fopen =對

Note: Depending on your system OS and configuration, the PHP.INI is located at various varied location, such as in Apache bin directory for Windows system or /usr/local/etc in FreeBSD Apache installation, if you don’t specify or point to PHP.INI in another directory.注:根據您的系統OS和配置,在php.ini是位於各種不同的位置,如在Apache bin目錄為Windows系統或/ usr /地方/等在FreeBSD上的Apache安裝,如果您不指定或點要在php.ini在另一個目錄。

If the error still happen and the PHP scripts still unable to connect to remote external servers and thus unable to download updates or retrieve files, check the user_agent setting in PHP.ini.如果仍存在錯誤發生和PHP腳本仍然無法連接到遠程外部服務器,從而無法下載更新或檢索文件,請檢查user_agent設置在php.ini的影響。

By default php.ini set the user_agent to “PHP” which signifies that it’s the script that try to access the web server.默認情況下, php.ini的設置user_agent ,以“ php ”的這標誌著它的腳本嘗試訪問Web服務器。 Some web servers will refuse and don’t allow script to access and receive the date from the server.一些Web服務器將拒絕和不允許腳本訪問和收到的日期從服務器。 So, by setting the user_agent to that of a web browser, PHP will let the web server know which kind of web browser will receive the date, and thus able to open the HTTP connection stream.因此,通過設置user_agent這一個網頁瀏覽器, PHP將讓Web伺服器知道有哪些種Web瀏覽器將收到的日期,從而能夠打開HTTP連接流。

The user_agent can be set to any kind of browser strings, for example of Internet Explorer:該user_agent可以設定為任何種瀏覽器的弦樂團,例如Internet Explorer的:

user_agent=”Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)” user_agent = “ mozilla/4.0 (兼容; msie 6.0的Windows NT 5.0 ) ”

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要說明 :這是一個機器翻譯網頁是“按原樣”提供的擔保。 Machine translation may be difficult to understand.機器翻譯可能很難理解。 Please refer to請參閱 original English article原來的英語文章 whenever possible.只要有可能。

Share and contribute or get technical support and help at分享和貢獻,或取得技術的支持和幫助,在 My Digital Life Forums 我的數字生活論壇 .



Leave a Reply離開的答复

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> 您可以使用這些標籤:的<a href="" title=""> <abbr title=""> <acronym title="">的<b> <blockquote cite=""> <cite>的<code> <刪除日期時間= “ ” >的<em>的<i> <q cite=""> <strike>的<strong>

Subscribe without commenting訂閱無評論


Custom Search

New Articles新的條款,

Incoming Search Terms for the Article傳入的搜索條件文章

failed to open stream: HTTP request failed! 未能打開流: HTTP請求失敗! - - failed to open stream: HTTP request failed 未能打開流: HTTP請求失敗 - - fsockopen php.ini fsockopen的php.ini - - file_get_contents failed to open stream file_get_contents未能打開流 - - enable fsockopen 使fsockopen - - failed to open stream: HTTP request failed! 未能打開流: HTTP請求失敗! - - file_get_contents php.ini file_get_contents的php.ini - - php http request PHP的HTTP請求 - - how to enable fsockopen 如何使fsockopen - - php httprequest PHP的httprequest - - fsockopen php fsockopen的PHP - - php.ini fsockopen php.ini的fsockopen - - fsockopen PHP5 fsockopen php5 - - fsockopen enable fsockopen啟用 - - php enable fsockopen PHP中,使fsockopen - - php5 fsockopen php5 fsockopen - - file_get_contents failed to open stream: HTTP request failed! file_get_contents未能打開流: HTTP請求失敗! - - fopen failed to open stream: HTTP request failed! fopen未能打開流: HTTP請求失敗! - - php open http PHP的開放的HTTP - - php5 fopen php5 fopen - - httprequest php httprequest的PHP - - fopen http request failed fopen HTTP請求失敗 - - failed to open stream HTTP request failed 未能打開流的HTTP請求失敗 - - php open stream PHP中打開流 - - php.ini fopen php.ini的fopen - - fopen failed to open stream HTTP request failed fopen未能打開流的HTTP請求失敗 - - fsockopen php ini fsockopen PHP中的INI - - "failed to open stream: HTTP request failed!" “未能打開流: HTTP請求失敗! ” - - fopen php.ini fopen的php.ini - - failed to open stream: HTTP request failed! 未能打開流: HTTP請求失敗! - - fsockopen+php.ini fsockopen + php.ini中 - - php.ini fsock php.ini的fsock - - php HTTP request failed PHP的HTTP請求失敗 - - enable fsockopen in php 使fsockopen在PHP - - fsockopen() enable fsockopen ( ) ,使 - - fsockopen in php fsockopen在PHP - - "failed to open stream: HTTP request failed" “未能打開流: HTTP請求失敗” - - failed to open stream: HTTP request failed! 未能打開流: HTTP請求失敗! in 在…內 - - enable file_get_contents 使file_get_contents - - PHP open http stream PHP的開放的HTTP流 - - fopen failed to open stream: HTTP request failed fopen未能打開流: HTTP請求失敗 - - file_get_contents http request failed file_get_contents HTTP請求失敗 - - php file_get_contents HTTP request failed PHP的file_get_contents HTTP請求失敗 - - enable fsockopen php 使fsockopen的PHP - - file_get_contents php ini file_get_contents PHP中的INI - - failed to open stream file_get_contents 未能打開流file_get_contents - - php.ini User_Agent php.ini的user_agent - - file_get_contents failed to open stream: HTTP request failed file_get_contents未能打開流: HTTP請求失敗 - - file_get_contents "failed to open stream" file_get_contents “未能打開流” - - php fsockopen http PHP的fsockopen的HTTP - -