简体   繁体   English

PHP WebDAV服务器证书失败

[英]PHP WebDAV Server Certificate Failed

Currently setting up a backup solution that sends a database dump and some other files from a Wordpress network to a NAS on my LAN, via WebDAV. 当前正在设置一个备份解决方案,该解决方案通过WebDAV将来自Wordpress网络的数据库转储和一些其他文件发送到我的LAN上的NAS。 I have installed PHP WebDAV on my web server and the basic code to get that that to work is: 我已经在Web服务器上安装了PHP WebDAV,使该代码正常工作的基本代码是:

webdav_connect('http://webdav.example.com/dav', 'davuser', 'davpassword');
webdav_put('/your/nice/thing.txt', $data);
webdav_close();

The issue is, my NAS requires this connection to be done via HTTPS, so in a web browser you'd see a warning which you can ignore, but PHP gives the following warning and the code fails: 问题是,我的NAS要求此连接必须通过HTTPS完成,因此在Web浏览器中,您会看到一条可以忽略的警告,但是PHP给出了以下警告,并且代码失败:

Warning: webdav_put() [function.webdav-put]: Server certificate verification failed: certificate issued for a different hostname, issuer is not trusted in /var/www/vhosts/blah/blah/blah.php on line 5 警告: webdav_put()[function.webdav-put]:服务器证书验证失败:为其他主机名颁发的证书,在第5行的/var/www/vhosts/blah/blah/blah.php中不信任颁发者

Is there a way in which I can ask PHP to ignore this, or will I need to obtain an SSL certificate? 有没有一种方法可以让PHP忽略它,还是需要获得SSL证书? The domain name used for accessing the WebDAV service on my NAS is one provided by Dynamic DNS if that makes a difference. 如果有区别的话,用于访问NAS上WebDAV服务的域名就是动态DNS提供的域名。

Is there a way in which I can ask PHP to ignore this, or will I need to obtain an SSL certificate? 有没有一种方法可以让PHP忽略它,还是需要获得SSL证书?

I don't know which HTTP Layer PHP WebDAV uses (which extension are you using?), but often it's possible to configure the underlying layer to ignore certificate errors. 我不知道PHP WebDAV使用哪个HTTP层(您正在使用哪个扩展名?),但是通常可以配置基础层以忽略证书错误。

If you need certificate verification for security reasons, you should obtain a valid certificate. 如果出于安全原因需要证书验证,则应获取有效的证书。

Just for completeness as I don't like leaving things un-answered. 出于完整性考虑,我不喜欢无所适从。 I've decided to access my WebDAV service via SMEStorage. 我已经决定通过SMEStorage访问我的WebDAV服务。 They provide an API which developers can use for this sort of thing: 他们提供了一个API,开发人员可以将其用于此类事情:

http://smestorage.com/?p=static&page=for_developers http://smestorage.com/?p=static&page=for_developers

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM