Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP 7 FTP extension is not loaded in Windows 7

Tags:

php

windows-7

ftp

I recently install PHP 7 in Windows 7 OS (32 bit). I used FTP library nicolab/php-ftp-client for FTP functions and I getting an exception as

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

And I see the code, there is

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

So I checked the loaded extension by 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]

There is no ftp extension. But in PHP site 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.

I restart the apache many times. Still FTP exception error shown. Could you please guide me to solve this issues.

The PHP version is

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
like image 502
Tamil Selvan C Avatar asked Dec 09 '15 08:12

Tamil Selvan C


1 Answers

A quick test on my system shows the same problem:

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.

Looking in the ext folder shows a php_ftp.dll. Enabling this in php.ini and rerunning the above gives:

C:\>php --ri ftp

ftp

FTP support => enabled
FTPS support => enabled

So, enable the extension and you'll be fine.

like image 120
timclutton Avatar answered Oct 05 '22 02:10

timclutton