Help with cURL

I was wondering and hoping someone could help me figure out what cURL package to install. Well, first, I have a script that I am running in part of an app that I built with PHP and that script uses cURL. My hosting provider says he has installed cURL because he can use it from the command-line, yet I get the error that the script made if cURL is not installed.

Here is the part of the script that checks and uses cURL:

                 // start curl up.
		// if no curl, hit an error.
			$this->error('CURL is not installed on this hosting account. Please contact your hosting provider and ask for it to be enabled.',true);
			$this->ch = curl_init();
			curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
	        @curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
	        curl_setopt($this->ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; PHP Website Search)");
	        curl_setopt($this->ch, CURLOPT_HEADER, 0);

Now, when I use the app on my testServer running MAMP, it works fine, but when I run it on my real-server I get the error that is above in the code if the curl_init function does not exist, which means that cURL is not installed.

But, as I mentioned before, my hosting provider said that cURL is installed. He also said, all of the libcurl packages are installed". He said that after I suggested that he installed those after finding this and [URL=“”]this via a quick Google Search for PHP cURL Package.

Does anyone know or have any suggestions on what cURL package I need to tell my hosting provide to install to get the PHP script working? (debian squeeze package)

I would really appreciate any and all suggestions!

Thanks in Advance & Best Regards,
Team 1504.

Are you sure the issue is not simply a PATH problem?

If you have SSH access to the server, try “whereis” to locate the installed cURL.

Path to what? cURL? I never write a path to cURL in the code above.

I dont have ssh access. The hosting provider does. What should I tell him to do to check or fix a PATH problem? He said he can use cURL from the command line (idk what that means)

It is one thing to install curl on the server, but PHP also needs to be configured with cURL.

To use PHP’s cURL support you must also compile PHP --with-curl[=DIR] where DIR is the location of the directory containing the lib and include directories.

If you do phpinfo(), do you see --with-curl in the configuration? If not, your host needs to configure PHP with it.

Well, I talked to my hosting provider and he said that he said he is uncomfortable recompiling PHP because that puts his site as well as others on the server at risk.

Also since Debian does it themselves and they would do what it is best, there is no need to re-do it especially just for me.

Are they any other solutions or possibilities? No packages that one can install? Because the hosting provider keep on asking for that.

Is there any mention of cURL when you do:



If worse comes to worse, ask him what Virtual Machine he runs for his hosting and if you create a properly compiled VM then would he consider firing it up and testing it on his server array. You then have to create a Debian VM with properly compiled php and upload it to you ISP.

It would be easier to move to a new host that does support CURL though.


Nice the print_r(get_loaded_extensions()) is good :slight_smile:

Yes it would be easier, but this host is a friend of mine. Thats also why i have the ability to contact him so much. We tried a package that someone suggested called php5-curl, but that didn’t seem to work.

Here is the approved and selected answer on a Q/A site that has to do a similar question:

No you don’t need to recompile.

there 3 different ways to enable/install php5-curl extension on Ubuntu. all of them are easy. here is the link to that. last 3 options starting with ‘compiling…’ all works for you. apply any of them. get file in extensions directory of php installation. then edit related extension line in php.ini file. restart the apache.

To which my host / friend emailed me: “Ah, “php5-curl”. That was the package name I needed. Try it now.”
But it doesn’t seem to be working.

[B]So now i have 2 questions:

1.) Should he have done something else? Does anyone think that answer, above from the Q/A site, is a good solution?
2.) Do you or does anyone think anyone on the PHP forum, here, would help me rewrite the part of the script that uses cURL so that it uses something that is supported?[/B]

I do not think I see it. Here is a link to it. What does that mean? I hope not bad news.

No, cURL is clearly not installed or enabled for this server – as far as PHP is concerned.

So, you will have to continue to support your support ( :expressionless: ) team, or think of another way round the problem you seem to have.

There are alternatives to using cURL on PHP.

I see that server has allow_url_fopen() turned “on”, which is a security setting mnay shared hosted suppliers used to turn off, as far as I know.

Why are you so keen to install cURL anyway?

Cups is onto a good question about what you need to do?

If you decide you want to continue to pursue CURL with PHP then here is a decent small page on php that gives the ‘nuts and bolts’: Given that this is a friend of yous some of this may be easier.

[*]You will need to know about basic compiling and making a file. See, typically it is like so (In your terminal as root):

  gunzip php-NN.tar.gz
  tar -xf php-NN.tar
  cd ../php-NN  ./configure --with-mysql --with-curl  
  make install


[*]You can get more info on compiling php at specifically you will need to look over the core options to see which ones you want to install core options in the appendix one that you won’t see is ''–with-curl" so be sure to include it when compiling.
[/LIST]Hope this helps

I mentioned Cups and ServerStorm just to separate my replies to there posts, but please feel free to read the entire post as it sums things up in


I was afraid it meant that.

So, you will have to continue to support your support ( :expressionless: ) team, or think of another way round the problem you seem to have.

i will check into that. Thank you for telling me!
Would you be willing to help me get the script to use url_fopen() instead of cURL if I showed the entire script and or just what i am trying to accomplish?

Because the script, that I bought :frowning: because I could not come up with something myself, apparently needs it as the snippet of it above returns the error when i run in on my live server.
And I thought that the easiest way to fixing the problem would be to install cURL, but so far no packages are working and my host is not keen on recompling PHP. And the original author, form whom i bought it from, has not replied and its been 3 weeks. And I just asked for general help so i am summing he doesn’t check that email anymore.


Off Topic:

First, I love the neuron avatar!

What this entire script is, is a search-engine for my site. I spent many night trying to write my own, but could not come up with anything. (More is explained in the earlier section of the post).

I am starting to think that using something besides cURL is the option left.

Does anyone have any clues / can anyone help me replace the parts of the script that use cURL with url_fopen() as that seems to be enabled? or if possible remove the cURL parts of the script.
I should warn you that it is quite messy.
I know I am asking for a lot, but if anyone would be willing to give any help, I would sincerely appreciate it!

Thanks in Advance & Best Regards,
Team 1504

[google]php alternatives to curl[/google]

From what you are saying it seems you are going out to one of the search engines maybe? … and pulling back search results of your own site?

from what i read through the code that seems like what part of it is doing?

Do you or anyone know how i / we could make a search engine in PHP that does not contact Google or something already functioning and just takes the $_Post of an input and displays a list of the instances where that word(s) is found in the specified url? the suer would not be able to define or change the url, but the programmer in the code.