ispCP - Board - Support
Problem with libcurl - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Development Area (/forum-1.html)
+--- Forum: General discussion (/forum-11.html)
+--- Thread: Problem with libcurl (/thread-780.html)



Problem with libcurl - gnatbite - 06-13-2007 02:17 AM

Hi guys, I installed libcurl for a Online shop running on my server. This online shop needs libcurl to commuicate with a special creditcard company. So I installed libcurl but I have got a problem. The curl library is not working properly.

That's what I have done.

- Created a normal domain for the shop
- Changed to PHP5 (like described here)
- Installed Zendoptimizer (necessary for the online shop)
- Installed libcurl
- Added Zend and Curl to the corresponding php.ini
Code:
zend_extension=/usr/lib/php5/ZendOptimizer.so
zend_optimizer.optimization_level=15
extension=curl.so

infophp() says that zend and curl are installed:

Code:
Zend OptimizerOptimization Pass 1     enabled
...

Code:
cURL support     enabled
cURL Information     libcurl/7.15.5 OpenSSL/0.9.8c zlib/1.2.3 libidn/0.6.5

But if I try to use the curl library, it doesnt work like it should.

Example from here
Code:
<?php

$ch = curl_init("http://www.example.com/");
$fp = fopen("example_homepage.txt", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);
curl_close($ch);
fclose($fp);
?>

If I do understand correct, the code above should write the index-page from example.com to the specified textfile: example_homepage.txt

But it doesnt do that. Instead of that, i get the following content in the textfile.

Code:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://myispcp-domain.com/">here</a>.</p>
<hr>
<address>Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_ssl/2.2.3 OpenSSL/0.9.8c Server at www.mydomain.com Port 80</address>
</body></html>

That seems to be kind of webpage generated by ispcp or something, because there is a link to my default ispcp-login. By the way, the domain myispcp-domain.com is also my hostname. Any ideas?

Does someone have any idea?


RE: Problem with libcurl - BeNe - 06-13-2007 03:35 AM

Maybe a new FastCGI problem Rolleyes
ephigenie knows perhaps a solution.


RE: Problem with libcurl - ephigenie - 06-13-2007 06:06 AM

mh the 301 is a redirection have you tried a remote site ? does that work ?

Perhaps the local site you want to access is redirected ... ? and curl just doesn't follow the redirection.
This could happen if you use a alias domain as target which directs to another domain on your server.

Please try with http://www.google.com ?


RE: Problem with libcurl - gnatbite - 06-13-2007 07:51 AM

ephigenie Wrote:mh the 301 is a redirection have you tried a remote site ? does that work ?

Perhaps the local site you want to access is redirected ... ? and curl just doesn't follow the redirection.
This could happen if you use a alias domain as target which directs to another domain on your server.

Please try with http://www.google.com ?

Hi, thx for your reply. After 4 hours I finally found the problem. There was a wrong DNS-Entry on the local DNS-Server for der second domain.


RE: Problem with libcurl - katun - 01-09-2008 07:54 AM

how do i install libcurl for php5-cgi?


RE: Problem with libcurl - joximu - 01-09-2008 08:32 AM

maybe "apt-get install libcurl3"
or is there a probem?


RE: Problem with libcurl - katun - 01-09-2008 08:54 AM

hmm. on my testserver (ubuntu, no ispcp, no fcgi) i typed "apt-get install php5-curl". Now the question: Can I do it identical on a debian system with ispcp and fcgi?


RE: Problem with libcurl - joximu - 01-09-2008 09:16 AM

just try it...
I just did it - seems to work... "apt-get install php5-curl" is good


RE: Problem with libcurl - BioALIEN - 01-09-2008 02:26 PM

Yes it should work fine, I did it a while back and works exactly as should. There was a problem with cURL about following location which seems to be no longer supported on php5+. If you experience any errors, comment that line out of your scripts Smile