You might have seen the error in CodeIgniter 4: The framework needs the following extension(s) installed and loaded: curl, intl. I will show you how here to solve this problem. This problem generally you will find in PHP based CodeIgniter 4 web framework in your environment when you try to run your application using CLI (command line interface).
One of the very good feature of CodeIgniter 4 framework is that you can deploy your application without using external server in your development environment. So you don’t need to use Apache HTTP Server for running your PHP based CodeIgniter 4 applications in development environment.
When you deploy your application using the command
php spark serve from the command line tool on your application’s root folder, then you may find the error message as shown in the following image:
The framework needs the following extension(s) installed and loaded: curl, intl.
From above error message you can probably easily identify the actual problem – the curl and intl packages are missing and these extensions are required to run your CodeIgniter 4 applications.
You don’t need to download any extension but PHP engine has already provided such extensions and you just need to let PHP know where it has to find. So the next section will explain how to resolve the issue you are facing while running the CodeIgniter 4 application.
In php.ini file add the following extensions. Make sure you have setup PHP engine as per the tutorial how to configure Apache HTTP Server, PHP and MySQL server.
The php.ini file can be found under the root folder of your PHP engine installation path (for example, C:/php-7.4.22) . You can use Notepad, Wordpad or Notepad++ to edit your pnp.ini file.
Make the following changes in your php.ini file to point to the right path of the required modules – curl and intl. The php_curl.dll and php_intl.dll files will be found under the ext folder of your PHP engine installation path (for example, C:/php-7.4.22). If you have different path of PHP installation then you have to update it.
Probably the similar kind of solution would be working for any missing extensions.
Testing the Application
Now once you update the php.ini file, save it and execute the command
php spark serve again in the command line tool on your project’s root folder. You will see that your server is running on port 8080 at localhost.
That’s all about how to solve the error: The framework needs the following extension(s) installed and loaded: curl, intl.