Unable to load dynamic library curl.so, undefined symbol curl_mime_type
Unable to load dynamic library curl.so, undefined symbol: curl_mime_type
WARNING:
PHP Warning: PHP Startup: Unable to load dynamic library ‘curl.so’ (tried: /usr/lib64/php/7.3/modules/curl.so (/usr/lib64/php/7.3/modules/curl.so: undefined symbol: curl_mime_type), /usr/lib64/php/7.3/modules/curl.so.so (/usr/lib64/php/7.3/modules/curl.so.so: undefined symbol: curl_mime_type)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘curl.so’ (tried: /usr/lib64/php/7.3/modules/curl.so (/usr/lib64/php/7.3/modules/curl.so: undefined symbol: curl_mime_type), /usr/lib64/php/7.3/modules/curl.so.so (/usr/lib64/php/7.3/modules/curl.so.so: undefined symbol: curl_mime_type)) in Unknown on line 0
PHP 7.3.17 (cli) (built: May 7 2020 21:04:09) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.17, Copyright (c) 1998-2018 Zend Technologies
PHP Warning: PHP Startup: Unable to load dynamic library ‘curl.so’ (tried: /usr/lib64/php/7.3/modules/curl.so (/usr/lib64/php/7.3/modules/curl.so: undefined symbol: curl_mime_type), /usr/lib64/php/7.3/modules/curl.so.so (/usr/lib64/php/7.3/modules/curl.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
curl.so is already there in /usr/lib64/php/7.3/modules directory :
# ll | grep curl
-rwxr-xr-x 1 root root 94168 May 8 02:45 curl.so
php curl is provided by php73-common package :
# yum provides php73-curl
Loaded plugins: priorities, update-motd, upgrade-helper
php73-common-7.3.2-1.13.amzn1.x86_64 : Common files for PHP
Repo : amzn-updates
Matched from:
Provides : php73-curl
php73-common package is Already installed :
php73-common-7.3.17-1.25.amzn1.x86_64
curl.so is already enabled :
; Enable curl extension module
extension=curl.so
FIX
Note: Please take a full server backup before doing any of the below steps.
I can see ‘curl.so’ file in the path /usr/lib64/php/7.3/modules/ and the extension is already enabled in /etc/php-7.3.d/20-curl.ini file.
php73-curl package is provided by php73-common package and it is already installed on the server.
I tried reinstalling the package ‘php73-common’ to fix the error but that didn’t work.
The error was due to old version of libcurl package. Check whether libcurl version is old.
Note: Please take a full server backup before doing the below steps. Any package having libcurl as dependency might have issues when it is upgraded.
Follow the below steps to fix the error :
1. Log into your CentOS / RHEL / Amazon Linux server as ‘root’ user or as any user with sudo privileges
2. Run the command ‘yum update libcurl’ to update the version of libcurl
Resolving Dependencies
–> Running transaction check
—> Package libcurl.x86_64 0:7.47.1-9.68.amzn1 will be updated
–> Processing Dependency: libcurl(x86-64) = 7.47.1-9.68.amzn1 for package: curl-7.47.1-9.68.amzn1.x86_64
—> Package libcurl.x86_64 0:7.61.1-12.93.amzn1 will be an update
–> Processing Dependency: libidn2.so.0(IDN2_0.0.0)(64bit) for package: libcurl-7.61.1-12.93.amzn1.x86_64
–> Processing Dependency: libidn2.so.0()(64bit) for package: libcurl-7.61.1-12.93.amzn1.x86_64
–> Running transaction check
—> Package curl.x86_64 0:7.47.1-9.68.amzn1 will be updated
—> Package curl.x86_64 0:7.61.1-12.93.amzn1 will be an update
—> Package libidn2.x86_64 0:2.3.0-1.4.amzn1 will be installed
–> Processing Dependency: libunistring.so.0()(64bit) for package: libidn2-2.3.0-1.4.amzn1.x86_64
–> Running transaction check
—> Package libunistring.x86_64 0:0.9.3-6.1.amzn1 will be installed
–> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================================================
Updating:
libcurl x86_64 7.61.1-12.93.amzn1 amzn-updates 307 k
Installing for dependencies:
libidn2 x86_64 2.3.0-1.4.amzn1 amzn-updates 172 k
libunistring x86_64 0.9.3-6.1.amzn1 amzn-main 419 k
Updating for dependencies:
curl x86_64 7.61.1-12.93.amzn1 amzn-updates 363 k
Transaction Summary
=============================================================================================================================================================================================================
Install ( 2 Dependent packages)
Upgrade 1 Package (+1 Dependent package)
Total download size: 1.2 M
Is this ok [y/d/N]: y
3. Type ‘y’ and press enter if yum ask for confirmation while updating libcurl package.
4. Run ‘php -m | grep curl’ to verify php curl extension is enabled
PHP 7.3.17 (cli) (built: May 7 2020 21:04:09)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.17, Copyright (c) 1998-2018 Zend Technologies
# php -m | grep curl
curl