[Solved] Fatal error: Call to undefined function json_decode()

Recently, we set up a test server and visited the website to check the error log. The following errors occurred:

Fatal error: Call to undefined function json_ decode()

The reason for this problem is that the JSON extension was not installed when PHP was installed

1. First, enter the JSON directory in Ext of PHP installation package, as shown in the following figure:

2. Execute phpize, as shown in the figure below:

3. Compile configuration, as shown in the figure below:

4. Install the extension, as shown in the figure below:

5. After successful installation, you can see the json.so extension, as shown in the following figure:

6. Finally, add extension = json.so to the php.ini configuration file, as shown in the following figure:

7. Finally, restart PHP FPM to see the extension loading

Similar Posts: