php ftp_connect 致命错误:调用未定义的函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18467876/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ftp_connect fatal error : call undefined function
提问by bash_profile blank
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 ?
出于某种原因,ftp_connect() 函数不起作用,当我尝试使用它时,它以致命错误结束,指出该函数未定义......令人惊讶的是,我仍然可以使用 ftp 客户端或通过终端使用 ftp 连接. 我该如何解决这个问题?
I run on Mountain Lion et I've got the 5.3 php version - I reinstalled it once hoping this would solve my problem.
我在 Mountain Lion 上运行,我有 5.3 php 版本 - 我重新安装了一次,希望这能解决我的问题。
回答by Menthos
Sounds like your PHP was not installed with --enable-ftp
or that the ftp module is disabled in your php.ini.
听起来你的 PHP 没有安装,--enable-ftp
或者你的 php.ini 中的 ftp 模块被禁用。
To check if ftp is enabled, create a page like this and browse to it:
要检查是否启用了 ftp,请创建一个这样的页面并浏览到它:
<?php
phpinfo();
?>
Look for "ftp support", it should be marked "enabled".
寻找“ftp support”,它应该被标记为“enabled”。
回答by Black Senator
Check PHP FTP installation manual
On PHP 7, You can enable it by adding this line to the php.ini file.
在 PHP 7 上,您可以通过将此行添加到 php.ini 文件来启用它。
extension=php_ftp.dll
回答by user1854438
回答by Doug Ross
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.
我发现(至少对于更高版本的PHP),那个路博?图雷克的回答大部分是正确的。至少在 Windows 上,您不需要(或想要)“.dll”后缀。
What is very odd is that the PHP.INI default configuration file doesn't even include a commented out line stating:
非常奇怪的是 PHP.INI 默认配置文件甚至不包括注释掉的行,说明:
;extension=php_ftp
So, as Lubo? said, adding:
那么,作为鲁波?说,并补充说:
extension=php_ftp
to the INI will work. That said, check your extfolder to make sure the FTP extension is there.
到 INI 将工作。也就是说,检查您的ext文件夹以确保 FTP 扩展名在那里。
回答by DoctorDroid Haiti
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.INISearch for : allow_url_include = OffChange Offto ON: Like this: allow_url_include = On
伙计们,我找到了解决方案,对我来说,我有 PHP 5,现在我有 PHP 7。我收到这个错误。操作:打开PHP.INI搜索:allow_url_include =关更改关到ON:像这样:allow_url_include =开
Restart all Serviceon Wamp server
重新启动Wamp 服务器上的所有服务
回答by Bruce
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).
我来到这里寻找答案并通过如下更改 php.ini 中的设置来修复我的问题。我删除了 ftp 延长线上的前导分号(底部)。
; - 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
回答by Manuele Perrone
I had the same problem, i fix it disabling the antivirus or add the apache server to the exception.
我有同样的问题,我修复它禁用防病毒或将 apache 服务器添加到异常中。