Problems Installing cURL

I have a full LAMP stack installed on a Ubuntu server. I tried installing cURL using apt-get install php5-curl

I get a notice saying several packages like php5-common and php5-mysql will also be installed.

This is strange because this software is already running on my machine. Is there a reason it's telling me to install these packages?

I'm afraid to complete the install, as I'm not sure if reinstalling php5-mysql and the others might corrupt my configurations.

8 Replies

A little confused on what you're trying to achieve.

php5-curl is the cURL module for php5. If you want the cURL program proper, apt-get install curl.

Uninstalling/reinstalling via APT shouldn't touch files in /etc (unless you –purge)

It only tries to create the files if they don't already exist. At the very least it gives you an option to update yours or not.

Thanks for the big help. Everything I was reading told me to install php5-curl. The apt-get install curl ran without problem.

I am however getting an internal server error whenever running a page that uses cURL. This is progress, as before I was getting an undeclared function error "curl_init() not found."

Any ideas why I'm getting this HTTP 500 error?

For my server, I used your original command: sudo apt-get install php5-curl

Did you remember to restart Apache after installation?

Yes, I've restarted the server. I also made sure to add "" to /etc/php5/apache2/php.ini and I've verified the package is installed with "dpkg -s curl"

Mm installing the curl package won't provide cURL support in PHP. For that, as per your original post, you must install the PHP cURL extension with apt-get install php5-curl.

I'd bet somewhere in your logs PHP complains it can't load Create a phpinfo() file and see if it lists cURL as loaded. Also for security I would recommend you remove such a file after you get this working, it's not a great idea to let the public access that file.

If it's not being loaded, install php5-curl. I don't get why it's listing already installed packages as must be installed, but accepting the installation shouldn't mess with your config at all.

How did you originally install PHP? If it involved 'tar' or 'make', that may explain it…

Also, if you haven't run 'apt-get update' and 'apt-get upgrade' in awhile, it may be forcing you to apply security updates as part of the installation. The wording is particular when that happens, though.

Not sure how PHP was installed, as I didn't do it. But I'm sure it wasn't with 'make.' I just installed that the other day. It could have been tar, but more than likely it was probably apt-get.

I did run apt-get update just before downloading curl.

I changed my error reporting on the script using cURL and it appears cURL isn't being recognized at all. I'm still receiving the 'undefined function init_curl()' error.

Downloading packages is really new to me, so I may have made some clumsy mistakes in downloading cURL. As stated in my original post, php5-curl required dependencies I wasn't sure about downloading. Someone on the Ubuntu forums advised to compile it from source, which I did. Though I installed it in the /usr directory. Not sure if this was a mistake, but cURL still wasn't running.

I then took Retrograde Inservsion's suggestion and ran apt-get install curl. Ubuntu notified me the package updated, but still no luck with getting cURL to run. I then moved cURL to the /etc directory.

It's been an awkward clumsy process, so I wouldn't be surprised if I've made more than one mistake. Thank you all for your suggestions I've gotten so far.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct