How to properly install a PHP extension?
Your configuration is wrong. The dll files you have enabled are compiled for Windows.
The correct way is to install php-mbstring package and let it enable the mbstring extension automatically:
sudo apt-get install php-mbstring You can then disable/enable the extension by using phpenmod/phpdismod commands:
sudo phpdismod mbstring # disable mbstring extension sudo phpenmod mbstring # enable mbstring extension again
Sources:
Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_mbstring.dll
Related videos on Youtube
Fnr
Updated on September 18, 2022Comments
-
Fnr over 1 year
I want to install some PHP extensions so I can run Laravel projects in the computer. I already uncommented the lines in the /etc/php/7.0/cli/php.ini dir, more precisely:
extension=php_mbstring.dll extension=php_mysqli.dll
extension=php_pdo_mysql.dll
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
extension=php_xmlrpc.dllThen I ran
sudo apt-get install php-mbstring php-mysqli php-pdo-mysql php-pdo-sqlite php-pgsql php-xmlrpc
and restarted apache servicesudo systemctl restart apache2
. Still, when I runphp --ini
I got:PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_mbstring.dll' - /usr/lib/php/20151012/php_mbstring.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_mysqli.dll' - /usr/lib/php/20151012/php_mysqli.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_pdo_mysql.dll' - /usr/lib/php/20151012/php_pdo_mysql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_pdo_sqlite.dll' - /usr/lib/php/20151012/php_pdo_sqlite.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_pgsql.dll' - /usr/lib/php/20151012/php_pgsql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_xmlrpc.dll' - /usr/lib/php/20151012/php_xmlrpc.dll: cannot open shared object file: No such file or directory in Unknown on line 0I know the problem reducts to only add the
.dll
file to this path but I guess there must be a standard way to do this. Or will I have to download/compile them manually and put there? Thanks in advance.By the way, I'm on linux mint 18.1 and using PHP 7
-
Fnr almost 7 yearsThat's strange, when I installed apache/php with apt-get the commented extensions were already with the .dll filetype. Also, I ran
phpenmod
for those extensions but still having the same error atphp --ini
-
ADDB almost 7 yearsYou understood that I tried to say, that uncommenting those lines was a MISTAKE. You should only use apt-get install and not the config.