【问题标题】:PHP 7 FTP extension is not loaded in Windows 7Windows 7 中未加载 PHP 7 FTP 扩展
【发布时间】:2016-03-14 10:36:27
【问题描述】:

我最近在 Windows 7 操作系统(32 位)中安装了 PHP 7。我将 FTP 库 nicolab/php-ftp-client 用于 FTP 功能,我得到一个异常为

致命错误:未捕获的 FtpClient\FtpException:FTP 扩展不是 加载!在

我看到了代码,有

if (!extension_loaded('ftp')) {
    throw new FtpException('FTP extension is not loaded!');
}

所以我通过php检查了加载的扩展

C:\Users\Tamil>php -m
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
filter
gd
hash
iconv
intl
json
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
Reflection
session
SimpleXML
soap
SPL
sqlite3
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]

没有 ftp 扩展。但是在 PHP 站点http://php.net/manual/en/ftp.installation.php

Windows 版本的 PHP 内置了对此扩展的支持。 您无需加载任何其他扩展即可使用 这些功能。

我多次重启 apache。仍然显示 FTP 异常错误。请您指导我解决这个问题。

PHP版本是

C:\Users\Tamil>php -v
PHP 7.0.0 (cli) (built: Dec  3 2015 11:36:59) (ZTS ) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

【问题讨论】:

    标签: php windows-7 ftp


    【解决方案1】:

    对我的系统进行的快速测试显示了同样的问题:

    C:\>php -v
    PHP 7.0.0 (cli) (built: Dec  3 2015 11:36:58) ( NTS )
    Copyright (c) 1997-2015 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
        with Xdebug v2.4.0RC2, Copyright (c) 2002-2015, by Derick Rethans
    
    C:\>php --ri ftp
    Extension 'ftp' not present.
    

    查看ext 文件夹会显示php_ftp.dll。在php.ini 中启用此功能并重新运行上述命令:

    C:\>php --ri ftp
    
    ftp
    
    FTP support => enabled
    FTPS support => enabled
    

    所以,启用扩展,你会没事的。

    【讨论】:

    • 启用是通过在 php.ini 中的任意位置添加 extension=php_ftp.dll 来完成的
    猜你喜欢
    • 1970-01-01
    • 2012-02-23
    • 2017-07-18
    • 2016-06-23
    • 1970-01-01
    • 2013-05-23
    • 1970-01-01
    • 2012-04-18
    • 1970-01-01
    相关资源
    最近更新 更多