简体   繁体   中英

PHP gives fatal error for curl extension in windows. curl_init undefined

i have tried everything to load curl extension but it is not displayed in the loaded extension list. 在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

In WAMPServer activating and deactivation extension for the WebServer (Apache) is simple

Use the WAMPServer menus, on the icon in the system tray (it may need to be takes out of the extension area to make sure it sits on the taskbar all the time.

left click wampmanager -> PHP -> PHP Extensions

You should see a menu popout like this

在此处输入图像描述

Notice, the extension names all listed, if they have a Green Tick then they are activated, if not, they are not. To activate or deactivate the extension click the extensions name. Wait 10 second while WAMPServer restarts Apache automatically for you and there you go, Job Done.

If you want to use PHP CLI

The PHP CLI is controlled differently, there are actually 2 php.ini files. The one in the wamp64\bin\php\php{version} controls the PHP CLI.

You have to edit this one yourself, so edit wamp64\bin\php\php7.4.16\php.ini and make sure that

extension=curl

does not have a # comment in front of it

Its a little odd that it is not already activated as WAMPServer comes, out of the box, with the curl extension pre-activated

as I was using multiple versions of PHP so after deselecting the current version, selecting another version and then again selecting back the current version and then restarting the server made it work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM