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 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示