2015-12-09 77 views
2

我最近在Windows 7 OS(32位)中安裝PHP 7。我使用的FTP庫nicolab/PHP的FTP客戶端的FTP功能和我得到一個例外,因爲PHP 7 FTP擴展未在Windows 7中加載

Fatal error: Uncaught FtpClient\FtpException: FTP extension is not loaded! in

而且我看到的代碼,有

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

The Windows version of PHP has built-in support for this extension. You do not need to load any additional extensions in order to use these functions.

我重新啓動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 

回答

8

我的系統上的快速測試顯示了同樣的問題:

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 

因此,啓用該擴展,你會沒事的。

+0

謝謝,它的工作 –