【发布时间】:2018-06-05 06:26:21
【问题描述】:
我尝试了所有可以找到的方法,例如此处的说明 How to get CURL to work with PHP on Windows? (WAMP)
将 dll 文件从 php7.2.0 文件夹复制到 apache2.4.18\ bin 文件夹
我的设置
win 10 64
wamp 3.1.1
php, 5.6.28, 7.0.4, 7.2
apache 2.4.18
curl 适用于任何其他 php 版本,但不适用于 7.2
查看extension_dir 路径,它指向正确的目录
extension_dir ="T:/wamp64/bin/php/php7.2.0/ext/"
加载 php 7.2 扩展
extension=bz2
extension=curl
;extension=dba
extension=com_dotnet
;extension=enchant
extension=fileinfo
;extension=ftp
extension=gd2
extension=gettext
extension=gmp
extension=intl
extension=imap
;extension=interbase
extension=ldap
extension=mbstring
extension=exif ; Must be after mbstring as it depends on it
extension=mysqli
;extension=odbc
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
;extension=oci8_12c ; Use with Oracle Database 12c Instant Client
;extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=phpdbg_webhelper
;extension=shmop
现在我看到在 7.0.4 中有 php_ 前缀和 dll 后缀
extension=php_curl.dll
但这是在 7.2 信息中
; When the extension library to load is not located in the default extension
; directory, You may specify an absolute path to the library file:
;
; extension=/path/to/extension/mysqli.so
;
; Note : The syntax used in previous PHP versions ('extension=<ext>.so' and
; 'extension='php_<ext>.dll') is supported for legacy reasons and may be
; deprecated in a future PHP major version. So, when it is possible, please
; move to the new ('extension=<ext>) syntax.
;
; Notes for Windows environments :
;
; - ODBC support is built in, so no dll is needed for it.
; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+)
; extension folders as well as the separate PECL DLL download (PHP 5+).
; Be sure to appropriately set the extension_dir directive.
其他人也有同样的问题,但没有解决方案http://forum.wampserver.com/read.php?2,149346,149609#REPLY
【问题讨论】:
-
你遇到了什么错误?
-
未定义函数 curl_init() 如果这就是你的意思,
-
@Benn 是的,这就是他的意思。这似乎也表明您正在运行
display_startup_errors在 php.ini 中禁用(或者它根本不在 .ini 中 - 如果它不在 php.ini 中,则默认值被禁用!),请设置display_startup_errors=1在 php.ini 中,重新启动一切并重试。