PHP WebDAV服务器证书失败
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.
目前正在设置一个备份解决方案,将Wordpress网络中的数据库转储和其他一些文件发送到我的NAS上 局域网,通过WebDAV。 我已经在我的Web服务器上安装了PHP WebDAV,并且基本代码可以实现: p>
webdav_connect('http://webdav.example.com/dav' ,'davuser','davpassword');
webdav_put('/ your / nice / thing.txt',$ data);
webdav_close();
code> pre>
问题是,我的NAS要求通过HTTPS完成此连接,因此在Web浏览器中您会看到一个警告,您可以忽略,但PHP会发出以下警告并且代码失败: p>
警告: strong> webdav_put()[function.webdav-put]:服务器证书验证失败:为不同的主机名颁发证书,发件人在 / var中不受信任 /www/vhosts/blah/blah/blah.php strong>第5行 p>
blockquote>
有没有办法可以让PHP忽略这一点, 或者我需要获得SSL证书吗? 用于访问我的NAS上的WebDAV服务的域名是动态DNS提供的域名,如果这会产生影响。 p>
div>
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:
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.