duan1933 2016-01-21 22:59
浏览 74
已采纳

synology php ftp_ssl_connect - 调用未定义的函数

First time asking a question here, please be gentle :-)

I'm writing a PHP command-line script on a Synology box to fetch files via ftps, and start out with this bit:

$ftp = ftp_ssl_connect("ftp.example.com");

When run from the command line, I get

Fatal error: Call to undefined function ftp_ssl_connect() in ...

phpinfo() tells me:

...
Registered PHP Streams => php, file, glob, data, http, ftp, https, ftps, zip, compress.zlib, compress.bzip2
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
...
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.1p-fips 9 Jul 2015
OpenSSL Header Version => OpenSSL 1.0.1p-fips 9 Jul 2015

and /etc/php/conf.d/extensions.ini contains extension = openssl.so (without an initial ;)

It seems to me that all the prerequisites for ftp_ssl_connect() are in place.

fwiw:

$ uname -a
Linux DiskStation01 2.6.32.12 #5644 Wed Oct 28 12:36:45 CST 2015 armv5tel GNU/Linux synology_88f6282_213

What would be the next place to look?

  • 写回答

2条回答 默认 最新

  • dounue1965 2016-01-21 23:07
    关注

    Type php -m to see the compiled in modules, as PHP does not ship the FTP extension by default if not on Windows. Calling phpinfo() should also show the compiler switches used, and if they include --enable-ftp.

    The curious thing is I just tried this on an RS812 of mine, and it shows both the FTP and OpenSSL moodules as included, and it works fine:

    nas-name> php -r "ftp_ssl_connect('test');"
    PHP Warning:  ftp_ssl_connect(): php_network_getaddresses: gethostbyname failed
    in Command line code on line 1
    

    This indicates the ftp_ssl_connect is working but not being able to parse the supplied host name. I have no idea why yours would be different unless you compiled PHP yourself.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器