我已经在笔记本电脑中设置了本地服务器(Windows 10家庭单一语言64位版本1803)。
我已按照此apache24下载并手动安装了php7,MySQL,phpMyAdmin,wordpress和tutorial。
我正在尝试启用cURL,因此在php.ini文件中我已更改
;extension=curl
到
extension=curl
我已经重新启动了apache服务器。之后,我在localhost / curl_enable.php上运行以下代码,检查是否启用了cURL。
<?php
echo 'Curl: ', function_exists('curl_version') ? 'Enabled' . "\xA" : 'Disabled' . "\xA";
?>
但是它仍然显示
Curl: Disabled
所以我错过了任何步骤。如何在我的系统中启用cURL?
答案 0 :(得分:1)
以下是在Windows上启用curl的步骤:
...
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "C:\PathToMyPhp\ext"
...
extension=php_curl.dll
...
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo = C:\PathToMyFile\cacert.pem
1-确保您的extension_dir指向php扩展目录。
2-取消注释或添加扩展名.dll名称。
以下是php扩展名正确的语法:php_nameOfTheExtension.dll
.dll放置在php的扩展目录中,或者如果您是第三方下载,则必须将其放在此处。
3-cacert.pem是可选的,用于SSL事务。
在此处下载:https://curl.haxx.se/docs/caextract.html
4-使用phpinfo()检查curl是否在列表中,并检查配置。
5-如果发生错误,请检查Apache的error.log和access.log
编辑1:
6-我忘记了:将php目录的路径添加到Windows环境PATH变量中以获取.dll依赖项。
此处的问题/响应: Enable CURL on Windows For PHP5.6.4
编辑2: 这是文件的路径:
取决于MySQL的安装和版本
C:\ Program Files \ MySQL \ MySQL Server 8.0 \ bin \ libeay32.dll
C:\ Program Files \ MySQL \ MySQL Server 8.0 \ bin \ ssleay32.dll
取决于您的php目录
C:\ php7 \ libssh2.dll
编辑3:
具有正确语法的扩展配置示例,该语法取自PHP5,但也适用于PHP7:
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5+)
; extension folders as well as the separate PECL DLL download (PHP 5+).
; Be sure to appropriately set the extension_dir directive.
;
;extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
;extension=php_ftp.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysqli.dll
;extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
;extension=php_odbc.dll
extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=php_snmp.dll
;extension=php_soap.dll
extension=php_sockets.dll
extension=php_sqlite3.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
extension=php_xsl.dll
zend_extension="C:\php-7.1.22\ext\php_opcache.dll"
zend_extension="C:\php-7.1.22\ext\php_xdebug-2.6.1-7.1-vc14-x86_64.dll"
希望这会有所帮助。