M.O.S. Studios Posted May 12 Share Posted May 12 Hey everyone, Here is a bit of a weird one. I set up ownCloud using a PAAS service and it is running well. However, when I try to use curl from PHP, I keep getting an error that says "Failed to connect to THEURL port 80: No route to host" This is weird for two reasons. 1. I also tried uploading it from my computer's terminal, using curl, and that 2. Until about a day ago, I had my own cloud on a shared host, and the PHP code worked just fine. Here is the PHP code I used: function uploadToOwncloud($args = array()){ $uploadPath = $args['uploadPath']; $product_data = fopen('php://memory', 'r+'); fputs($product_data, $args['product_data']); rewind($product_data); $user = $args['user']; $pass = $args['password']; $url = "MYOWNCLOUDURL.COM/remote.php/webdav" .urlencode($uploadPath); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERPWD, "$user:$pass"); curl_setopt($ch, CURLOPT_PUT, 1); curl_setopt($ch, CURLOPT_INFILE, $product_data); curl_setopt($ch, CURLOPT_INFILESIZE, fstat($product_data)['size']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary $curl_response_res = curl_exec ($ch); var_export(curl_error($ch)); return; } Here is the terminal command I used: curl -u "user:password" -T test.txt "http://myowncloudurl.com:80/remote.php/webdav/text.txt" I tried adding my domains to the whitelist, and turning off the fire wall Thanks Quote Link to comment https://forums.phpfreaks.com/topic/327789-no-route-to-host-with-owncloud/ Share on other sites More sharing options...
gizmola Posted May 13 Share Posted May 13 You should clarify: You have not changed client php code at all? When you ran curl from the cli on this same computer, did that work? Have you rebooted, the workstation you are using to connect to your owncloud? If it involved a DNS change on your part, if the DNS information was cached and stale, it's possible that your workstation was still resolving to the old host, and an IP that perhaps no longer works. It's also possible that this PaaS platform doesn't have port 80 open. Quote Link to comment https://forums.phpfreaks.com/topic/327789-no-route-to-host-with-owncloud/#findComment-1653904 Share on other sites More sharing options...
M.O.S. Studios Posted May 14 Author Share Posted May 14 Thanks for the reply. 7 hours ago, gizmola said: You should clarify: You have not changed client php code at all? When you ran curl from the cli on this same computer, did that work? I only changed the URL from the OwnCloud host to the new one. When I ran the terminal, it worked perfectly. 7 hours ago, gizmola said: Have you rebooted, the workstation you are using to connect to your owncloud? If it involved a DNS change on your part, if the DNS information was cached and stale, it's possible that your workstation was still resolving to the old host, and an IP that perhaps no longer works. I rebooted and tried from a private browser that doesn't keep the cache. 7 hours ago, gizmola said: It's also possible that this PaaS platform doesn't have port 80 open. When I did it from the terminal, I did it from port 80, and it worked Quote Link to comment https://forums.phpfreaks.com/topic/327789-no-route-to-host-with-owncloud/#findComment-1653916 Share on other sites More sharing options...
gizmola Posted Friday at 10:15 PM Share Posted Friday at 10:15 PM Based on your statements, the only thing I can think of, is that the new server might be restricting PHP from making socket connections of any type. Given that you are running this, I gather as page triggered within the web server (php running via the web server) then it might be something in the php.ini setting that is different and more restrictive. I would go through the php.ini for the new server in detail, starting with a basic phpinfo(). Quote Link to comment https://forums.phpfreaks.com/topic/327789-no-route-to-host-with-owncloud/#findComment-1654146 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.