This time I want to share how to install Curl in PHP5 on Linux (I’m using Ubuntu 8.10) with the Apache web server. But if you have any questions about installing php-curl in another environment, feel free to contact me or leave a comment — I’ll be glad to help.
Okay, let’s start by checking if php-curl is already installed on your server or not.
To check it please follow these steps:
1. Create a file in your web server root (in Ubuntu it would be in /var/www), name it info.php.
2. Open that file and type this command:
<?php phpinfo(); ?>
3. Save that file.
4. Open your favorite browser and open that file (e.g., http://localhost/info.php).
5. You will now see the information about your PHP installation.
6. Search for Curl, and if you cannot find it, it means your PHP doesn’t have curl installed.
To install php-curl please follow these steps:
1. Open your terminal and type this command:
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl php5-mcrypt
2. After it finishes, open php.ini (mine is at /etc/php5/apache2/php.ini) and add this: extension=curl.so
3. Save the file and restart Apache with this command:
/etc/init.d/apache2 restart
4. Check the PHP information page again, you will find PHP-CURL installed.
5. That’s it.
Most hosting providers today already have Curl installed on their server.
