PHP WebDAV 服务器证书失败

发布于 2024-12-17 03:05:13 字数 635 浏览 6 评论 0原文

目前正在设置一个备份解决方案,通过 WebDAV 将数据库转储和一些其他文件从 Wordpress 网络发送到我的 LAN 上的 NAS。我已经在我的 Web 服务器上安装了 PHP WebDAV,使其正常工作的基本代码是:

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

问题是,我的 NAS 要求通过 HTTPS 完成此连接,因此在 Web 浏览器中您会看到一条警告,您可以忽略,但 PHP 给出以下警告并且代码失败:

警告: webdav_put() [function.webdav-put]:服务器证书验证失败:为不同主机名颁发的证书,颁发者在 /var/www/vhosts/ 中不受信任blah/blah/blah.php 第 5 行

有没有办法让 PHP 忽略这个,或者我需要获取 SSL 证书?用于访问我的 NAS 上的 WebDAV 服务的域名是动态 DNS 提供的域名(如果有区别的话)。

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. I have installed PHP WebDAV on my web server and the basic code to get that that to work is:

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:

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

Is there a way in which I can ask PHP to ignore this, or will I need to obtain an SSL certificate? The domain name used for accessing the WebDAV service on my NAS is one provided by Dynamic DNS if that makes a difference.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光沙漏 2024-12-24 03:05:13

有没有办法让 PHP 忽略这个,或者我需要获取 SSL 证书?

我不知道 PHP WebDAV 使用哪个 HTTP 层(您使用哪个扩展?),但通常可以配置底层以忽略证书错误。

如果出于安全原因需要进行证书验证,您应该获取有效的证书。

Is there a way in which I can ask PHP to ignore this, or will I need to obtain an SSL certificate?

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.

If you need certificate verification for security reasons, you should obtain a valid certificate.

吃→可爱长大的 2024-12-24 03:05:13

只是为了完整性,因为我不喜欢让事情没有答案。我决定通过 SMEStorage 访问我的 WebDAV 服务。他们提供了一个 API,开发人员可以使用该 API:

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

Just for completeness as I don't like leaving things un-answered. I've decided to access my WebDAV service via SMEStorage. They provide an API which developers can use for this sort of thing:

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文