Reputation: 1362
I am running PHP code with the following code invovled:
$ch = curl_init();
When I get to this line, the following error is returned:
Fatal error: Call to undefined function curl_init() in C:\xampp\htdocs\myfiles\API\IPVIKING_API.php on line 79
Now I've found all the answers talking about enabling the curl extension in the php.ini file, and I've done that, following this question here: How to enable curl in xampp?.
My problem is I do not have these 3 files:
C:\Program Files\xampp\apache\bin\php.ini
C:\Program Files\xampp\php\php.ini
C:\Program Files\xampp\php\php4\php.ini
I instead have 2 files called
C:\Program Files\xampp\php\php.ini-development
C:\Program Files\xampp\php\php.ini-production
I've uncommented the
;extension=php_curl.dll
line in both of them, restarted both my browser and xampp, yet it still gives me the same error. Suggestions?
Upvotes: 0
Views: 4591
Reputation: 5752
search for 'php.ini' file in
xampp\php\ directory
open php.ini
find for 'curl'
you will get line
;extension=php_curl.dll
uncomment it by removing semicolon at front of the line
extension=php_curl.dll
Upvotes: 1
Reputation: 1
There is a file named php (I think this is the real php.ini) with the type as configuration settings that is the one you need to uncomment extension = php_curl.dll. You should also uncomment the .ini-development
and .ini-production
. Restart and both browser and apache and it should work.
Upvotes: 0
Reputation: 14237
You should move C:\Program Files\xampp\php\php.ini-production to C:\Program Files\xampp\php\php.ini.
rename "C:\Program Files\xampp\php\php.ini-production" "C:\Program Files\xampp\php\php.ini"
And then change:
;extension=php_curl.dll
to
extension=php_curl.dll
Then restart Apache.
Some systems require two files to be copied from where PHP is installed to your WINDOWS\System32 directory:
libeay32.dll
ssleay32.dll
Update:
copy "C:\Program Files\xampp\php\php.ini" "C:\xampp\php\php.ini"
Upvotes: 2
Reputation: 27295
Make an
<?php phpinfo(); ?>
there you can see which php.ini is loaded. In this file you uncomment the the extension line.
When there is no php.ini in this path which is in the phpinfo this should be xampp/php/php.ini then rename one of the two files
C:\Program Files\xampp\php\php.ini-development
to
C:\Program Files\xampp\php\php.ini
Upvotes: 3