Enable cUrl in PHP on windows and Linux

cURL in PHP is very powerful library and is used extensively in PHP applications. But we need to enable it in php.ini before using it. Once enabled you can use it in all your projects or scripts on that server. Here is how you can enable curl in php.ini.

Enable cUrl on Windows:

1. Locate your PHP.ini file, in your XAMPP folder or PHP folder.
2. Open the PHP.ini in notepad
3. Search for following: ;extension=php_curl.dll
4. Uncomment this by removing the semi-colon “;” before it, as shown in below image:

curl-in-php-ini

5. Save and Close PHP.ini
6. Restart your Apache web server

 

Enable CURL in Ubuntu:

Run the following command on terminal:

 

Enable cUrl on open Suse:

In SUSE Linux:

On terminal type following:

then restart apache:

 

To check if cUrl is enabled or not follow below steps:

1. create a php file, say phpinfo.php on root (in my case, you can create it on any other folder you want) of your web server.
2. Open phpinfo.php in notepad and type following:

3. Save it and close notepad.
4. Go to your web browser and access it via URL, in my case it will be http://localhost/phpinfo.php
5. Search for “curl” on web page, if cUrl is enabled you will see something like as shown in below screenshot.

curl-enabled

Leave a Reply

Your email address will not be published. Required fields are marked *