LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 05-08-2006, 03:24 AM   #1
DangNewbie
LQ Newbie
 
Registered: Apr 2004
Posts: 13

Rep: Reputation: 0
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!
 
Old 05-08-2006, 03:29 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
can you ping the site?
 
Old 05-08-2006, 03:35 AM   #3
DangNewbie
LQ Newbie
 
Registered: Apr 2004
Posts: 13

Original Poster
Rep: Reputation: 0
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...
 
Old 05-08-2006, 03:40 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 05-08-2006, 04:01 AM   #5
DangNewbie
LQ Newbie
 
Registered: Apr 2004
Posts: 13

Original Poster
Rep: Reputation: 0
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...
 
Old 05-08-2006, 04:09 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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"
 
Old 05-08-2006, 04:13 AM   #7
DangNewbie
LQ Newbie
 
Registered: Apr 2004
Posts: 13

Original Poster
Rep: Reputation: 0
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...
 
Old 05-08-2006, 04:24 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 05-08-2006, 04:30 AM   #9
DangNewbie
LQ Newbie
 
Registered: Apr 2004
Posts: 13

Original Poster
Rep: Reputation: 0
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!
 
Old 05-08-2006, 04:43 AM   #10
DangNewbie
LQ Newbie
 
Registered: Apr 2004
Posts: 13

Original Poster
Rep: Reputation: 0
Ok, just one more dumb question...

Any idea how I change the http_proxy....
 
Old 05-08-2006, 09:32 AM   #11
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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?)
 
Old 05-08-2006, 12:12 PM   #12
DangNewbie
LQ Newbie
 
Registered: Apr 2004
Posts: 13

Original Poster
Rep: Reputation: 0
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.
 
Old 05-08-2006, 12:21 PM   #13
DangNewbie
LQ Newbie
 
Registered: Apr 2004
Posts: 13

Original Poster
Rep: Reputation: 0
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...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
passwd returning ldap error flybynight446 Linux - Software 1 02-09-2006 05:45 AM
startx returning an error lg_alucard Slackware 5 01-10-2005 05:17 PM
Wget and cURL can't connect umberleigh Linux - Newbie 0 09-21-2004 05:59 PM
Error returning - t: NT_STATUS_OK May1950 Linux - Newbie 1 04-23-2004 02:01 AM
Error returning browse list term Linux - Networking 2 06-24-2001 11:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration