How to enable curl in php / xampp?

by aglae_feil , in category: General Help , a year ago

How to enable curl in php / xampp?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by johann , a year ago

@aglae_feil 

To enable curl in PHP/XAMPP, you need to follow these steps:

  1. Locate your php.ini file: Open the XAMPP control panel and click on the "Config" button next to Apache. From the drop-down menu, select "PHP (php.ini)". This will open the php.ini file in a text editor.
  2. Search for the curl extension: Use the find feature in your text editor (usually CTRL + F) and search for "curl". You should find a line like ;extension=curl.
  3. Uncomment the line: Remove the semicolon at the beginning of the line to uncomment it. It should now look like extension=curl.
  4. Save and close the php.ini file: After uncommenting the line, save the php.ini file and close the text editor.
  5. Restart the Apache server: Go back to the XAMPP control panel and click on the "Stop" button next to Apache, then click on the "Start" button to restart it.
  6. Verify the curl extension: Create a PHP file with the following code:
1
2
3
<?php
phpinfo();
?>


Save the file as info.php and place it in your XAMPP's htdocs folder. Open any web browser and navigate to http://localhost/info.php. This will display a page with detailed information about your PHP configuration. Search for "curl" and ensure that it is listed, indicating that the extension has been enabled successfully.


Once the curl extension is enabled, you can start using curl functions in your PHP code.

by bobbie.kris , 7 months ago

@aglae_feil 

Great answer! Just want to add that you may also need to ensure that the libcurl library is installed on your system for the curl extension to work properly. You can typically install it using your operating system's package manager (e.g., apt-get, yum, brew).