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 鼠标右键,撤销删除 复制 移动,要怎样删除
  • ¥15 使用MATLAB进行余弦相似度计算加速
  • ¥15 服务器安装php5.6版本
  • ¥15 我想用51单片机和数码管做一个从0开始的计数表 我写了一串代码 但是放到单片机里面数码管只闪烁一下然后熄灭
  • ¥20 系统工程中,状态空间模型中状态方程的应用。请猛男来完整讲一下下面所有问题
  • ¥15 我想在WPF的Model Code中获取ViewModel Code中的一个参数
  • ¥15 arcgis处理土地利用道路 建筑 林地分类
  • ¥20 使用visual studio 工具用C++语音,调用openslsx库读取excel文件的sheet问题
  • ¥100 寻会做云闪付tn转h5支付链接的技术
  • ¥15 DockerSwarm跨节点无法访问问题