如何在没有PECL的情况下获得http_parse_headers的功能? [英] How to get the functionality of http_parse_headers without PECL?
问题描述
我在Windows上使用PHP 5.3.5,但我没有找到任何适用于我的安装的 pecl_http.dll
。
I am using PHP 5.3.5 on windows, and I didn't find any pecl_http.dll
that works with my installation.
所以我的问题是,
我如何获得 http_parse_headers
而不使用PECL?
How do I get the functionality of http_parse_headers
without using PECL?
推荐答案
您可以获取Windows的扩展程序
You can get the extension for Windows at
- http://downloads.php.net/pierre/
这是 php_http-5.3 - * - x86.zip
文件之一。检查您安装的PHP并选择正确的PHP,例如我的PHP是php-5.3.6- nts-Win32-VC9 -x86,所以我需要php_http-5.3- nts-svn20091125-vc9 -x86.zip。
It's one of the php_http-5.3-*-x86.zip
files. Check which PHP you have installed and pick the right one, e.g. my PHP is a php-5.3.6-nts-Win32-VC9-x86, so I needed php_http-5.3-nts-svn20091125-vc9-x86.zip.
下载zip并将php_http.dll解压缩到您的扩展文件夹。扩展文件夹应该是php安装目录中的/ ext文件夹。如果您不确定,请打开您的php.ini文件并搜索以下行:
Download the zip and extract the php_http.dll to your extension folder. The extension folder should be the /ext folder in your php installation directory. If you are not sure, open your php.ini file and search for these lines:
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = .\ext
extension_dir的值是你拥有的地方放置DLL。如果您不确定php.ini所在的位置,请打开命令提示符并执行
The value for extension_dir is where you have to place the dll. If you are unsure where your php.ini is located, open a command prompt and do
php --ini
这将告诉你php.ini的位置。它将输出类似
This will tell you where your php.ini is. It will output something like
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: C:\php5\php-5.3.6-nts-Win32-VC9-x86\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
复制dll后,将扩展名添加到php.ini中以启用它。找到它所说的内容
After you have copied the dll, add the extension to your php.ini to enable it. Find where it says something like
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
应该有多行类似于:
;extension=php_sybase_ct.dll
extension=php_tidy.dll
;extension=php_xmlrpc.dll
extension=php_xsl.dll
;extension=php_zip.dll
添加以下行:
extension=php_http.dll
保存php.ini并在命令提示符下键入以下内容:
Save the php.ini and type the following at your command prompt:
php --ri http
您现在应该从
http
HTTP Support => enabled
Extension Version => 1.7.0-dev
… more stuff
这意味着,您已成功安装了扩展程序现在可以使用它。
This means, you have successfully installed the extension and can use it now.
注意,为了能够在Windows上加载此扩展,您还需要加载以下PHP扩展:hash,iconv和SPL。
Note, that in order to be able to load this extension on Windows, you additionally need to load the following PHP extensions: hash, iconv and SPL.
这篇关于如何在没有PECL的情况下获得http_parse_headers的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!