bash_profile blank
bash_profile blank

Reputation: 311

ftp_connect fatal error : call undefined function

For some reason the ftp_connect() function doesn't work, when I try to used it it ends with a fatal error stating that this function is undefined... Surprisingly I can still use a ftp client or use an ftp connection through the Terminal. How may I solve this problem ?

I run on Mountain Lion et I've got the 5.3 php version - I reinstalled it once hoping this would solve my problem.

Upvotes: 15

Views: 40413

Answers (7)

Black Senator
Black Senator

Reputation: 459

Check PHP FTP installation manual

On PHP 7, You can enable it by adding this line to the php.ini file.

extension=php_ftp.dll

On PHP 8+ enable this line in php.ini:

extension=ftp

Upvotes: 19

user1854438
user1854438

Reputation: 1842

I ran into the same issue. After I checked this one setting, it worked just fine.

enter image description here

Upvotes: 13

Bruce
Bruce

Reputation: 1

I came here looking for an answer and fixed mine by changing the setting in php.ini as below. I removed the leading semicolon on the ftp extension line (at the bottom).

; - 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.
;
extension=bz2
extension=curl
;extension=dba
extension=com_dotnet
;extension=enchant
extension=fileinfo
extension=ftp

Upvotes: 0

DoctorDroid
DoctorDroid

Reputation: 243

Guys I find the Solution, For me I had PHP 5 and now I have PHP 7. I get this error. Do this: Open PHP.INI Search for : allow_url_include = Off Change Off to ON: Like this: allow_url_include = On

Restart all Service on Wamp server

Upvotes: -1

Doug Ross
Doug Ross

Reputation: 46

I found that (at least for higher versions of PHP), that Luboš Turek's answer is mostly correct. On Windows, at least, you don't need (or want) the ".dll" suffix.

What is very odd is that the PHP.INI default configuration file doesn't even include a commented out line stating:

;extension=php_ftp

So, as Luboš said, adding:

extension=php_ftp

to the INI will work. That said, check your ext folder to make sure the FTP extension is there.

Upvotes: 0

Manuele Perrone
Manuele Perrone

Reputation: 29

I had the same problem, i fix it disabling the antivirus or add the apache server to the exception.

Upvotes: -2

Menthos
Menthos

Reputation: 330

Sounds like your PHP was not installed with --enable-ftp or that the ftp module is disabled in your php.ini.

To check if ftp is enabled, create a page like this and browse to it:

<?php
phpinfo();
?>

Look for "ftp support", it should be marked "enabled".

Upvotes: 8

Related Questions