Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-08-2006, 03:24 AM
|
#1
|
LQ Newbie
Registered: Apr 2004
Posts: 13
Rep:
|
Why is my curl returning error 7 can't connect for everything?
Hi All,
The subject pretty much says it all, but here is a bit more description:
I am running mandrivia 10.1, a pretty fresh install. I have curl and libcurl 7.12.1, the server is behind a router, but that has never interfered before. Curl was working fine on my last install, but has now stopped working.
All I get is "curl (7) couldn't connect" no matter what I try to do with it...
Any ideas? Let me know if you need more info...
Thanks!
|
|
|
05-08-2006, 03:29 AM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
can you ping the site?
|
|
|
05-08-2006, 03:35 AM
|
#3
|
LQ Newbie
Registered: Apr 2004
Posts: 13
Original Poster
Rep:
|
Yes.
Hi, thanks for your reply.
I can ping all the sites I have tried (google.com, yahoo.com, localhost, etc) via terminal, if that is what you mean. Doesn't seem to matter what the site is. I can't even curl my own box via localhost or my own ip or network name, all of which load fine in a browser.
I did install and then uninstall a newer version of curl via source - could it have messed up one of my env-vars maybe? I don't know what curl needs to be able to run...
|
|
|
05-08-2006, 03:40 AM
|
#4
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
curl shouldn't implicitly need anything really, it's just a simple web client. try adding extra -v's to the command line, see where it gets step by step. only thing that i've seen affect it's abilities is when it tries to hit an ssl site without the right libraries, but if you're just using straight http that's irrelevant. if you can show us the WHOLE curl output, including your command line with those -v's and we'll see.
|
|
|
05-08-2006, 04:01 AM
|
#5
|
LQ Newbie
Registered: Apr 2004
Posts: 13
Original Poster
Rep:
|
Ah, that even helped right there....
I hadn't realized I could make it verbose... Being a newbie sucks, I hope it's over soon.
I am getting back:
[root@lini root]# curl -v -v -v http://www.linuxquestions.org
* About to connect() to 192.168.0.1 port 1080
* Trying 192.168.0.1... * Connection refused
* Closing connection #0
curl: (7) couldn't connect
This means it is trying to get out the router and can't, which makes sense. It is returning the error instantaneously, not like it is waiting for a site or anything, so the problem has to be close to home...
|
|
|
05-08-2006, 04:09 AM
|
#6
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
hmm, ok. so i would think that you have some bizarre proxy issue if you can ping ok. does your http_proxy variable contain 192.168.0.1:1080 ? (run 'echo $http_proxy') i assume curl does work if you use the ip address directly? e.g. "curl 1.2.3.4:80"
|
|
|
05-08-2006, 04:13 AM
|
#7
|
LQ Newbie
Registered: Apr 2004
Posts: 13
Original Poster
Rep:
|
No love here
I tried curling some of the sites in question, and the router, by ip, but none of them worked - same result as by domain.
The http_proxy is 192.168.0.1 with no port.
Do I need the http proxy for everything to work? I Could conceivably take it out. It seems odd that browsers, email, etc all work, and only curl is fried...
|
|
|
05-08-2006, 04:24 AM
|
#8
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
yes that is odd... essemtially if you don't *need* a proxy, don't use a proxy. thing is that the errors aren't that consistent with a proxy, as they will normally say they are connecting to a proxy. I think. If you temporarily just put http_proxy="" infront of the curl, it'll bypass the proxy and go direct.
|
|
|
05-08-2006, 04:30 AM
|
#9
|
LQ Newbie
Registered: Apr 2004
Posts: 13
Original Poster
Rep:
|
That did it.
Hey, you are right, that makes it work.
Weird, but whatever works. I guess it set the proxy up when I did the network setup stuff. If everything will work without it, I will just take it back out.
Thank you - I am really grateful. Such a dumb little thing when you know what you are doing, but it was driving me crazy.
Have a good night!
|
|
|
05-08-2006, 04:43 AM
|
#10
|
LQ Newbie
Registered: Apr 2004
Posts: 13
Original Poster
Rep:
|
Ok, just one more dumb question...
Any idea how I change the http_proxy....
|
|
|
05-08-2006, 09:32 AM
|
#11
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
well it's more about wondering what made it be that way in the first place. generally this would be a "network proxy" widgetty configuration tool in a menu somewhere. i do not know where this actually get's held, i assume that it's held at desktop level (i assume if you quit X and do it it works just fine?)
|
|
|
05-08-2006, 12:12 PM
|
#12
|
LQ Newbie
Registered: Apr 2004
Posts: 13
Original Poster
Rep:
|
That makes is even weirder then.
You are right, if I exit X (rather, select failsafe from the graphical boot menu, I don't seem to be able to get out of X entirely, CTRL+ALT+BACKSPACE only takes me back to the X login), curl works just fine from the command line.
The problem that kicked off the whole thing, though, is that I am using curl via php (both by the curl functions and by passing it to command via exec() show the same result), and the error is coming back as 7 all the time. It should be running under apache or nobody, I imagine. Could the fact that I am running X and logged in as root or a user affect that?
The problem persists in php even when I log in with failsafe and get curl working ok for my own user.
|
|
|
05-08-2006, 12:21 PM
|
#13
|
LQ Newbie
Registered: Apr 2004
Posts: 13
Original Poster
Rep:
|
I've managed to fix the php issue (if I want to use exec at least) by doing this:
Code:
$execString = "http_proxy=\"\" && curl -d \"".$this->PostArgString."\" ".$this->PostURL;
I think I will attack my configuration tools and see if I can figure out where that proxy setting is coming from...
|
|
|
All times are GMT -5. The time now is 10:23 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|