CURL Failed to connect: Permission denied

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

CURL Failed to connect: Permission denied

Post by kendall »

hello,

I am using PHP's CURL to connect to a secure URL. however, while i may get a successfull response on occassions i sometimes get a curl_error "Permission denied" (usually on a consecutive curl_init(). refreshing the page)

Now what is un-usual about this is that before i was using a self signed certificate for which i got no permission denied problems. now i went and got a commercial one.

has PHP's curl function have any restrictions on connection limits or number of times it is allowed to make a connection or re-connect?
when using SSL do i need to pass any keys and use any of curl's SSL options to ensure a connection everytime?

what can be causing this "drop" in connection because as stated it works on occassions
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

the fact that it works sometimes and not others is puzzling. you definitely need to use the ssl portion of cURL though if you're connecting to a secured site.
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

Burrito,

im researching through the manual and came across the SSL options...is it that i need to be assigning all the respective SSL options?

as the only one im using really is CURLOPT_SSL_VERIFYHOST
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

I've always only ever used VERIFYPEER.

like this:

Code: Select all

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

Edit: 12:43 GMT 5 hours

Actually as of this post...it hasnt really worked....again on occassion...but like if i attempt to refresh the page i get the permission denied....is this strange or is it me?

END

Burrito,

correct...i have been googling and came up with some interesting forum posts concerning this. I have since set some other curl options of which includes that same option u stated....

it works fine!

but what does these options mean anyway...im still googling but i have not found a proper explanation as to what significance these options are

Code: Select all

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
		curl_setopt($ch, CURLOPT_CAINFO, NULL);
		curl_setopt($ch, CURLOPT_CAPATH, NULL);
i really want to ensure i have taken the correct steps to ensure a secured and authorised connection
Post Reply