How do I install iconv extension for php 8.2 without making a mess?

On all the linux distributions I’ve used before Manjaro (Debian, Ubuntu, OpenSUSE), when I wanted to install some extension for PHP, the easiest and cleanest way was always to install a package through the distribution’s official package manager. For any given extension xxxx, if my version of php was N, there would always be a package called either php-xxxx or phpN-xxxx or something similar. I Never needed a php extension for which there wasn’t a package.

Now on Manjaro, I have php 8.2:

$ php -i
PHP 8.2.5 (cli) (built: Apr 12 2023 15:55:38) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.5, Copyright (c) Zend Technologies
$ pacman -Q |grep php 
php 8.2.5-1
php-gd 8.2.5-1

and I need to install iconv.

So I did:

pacman -Ss php |grep iconv 

and it finds nothing.

So I opened Pamac from the tray icon on the bottom-left of the screen, and searched for “iconv”.

It finds “php82-iconv”:
image

But if I try to select it and install, I get this prompt:

image

It seems very strange that I need to choose something called “smtp-forwarder”. I have no idea what that is but I know what smtp is and what “forward” means, and it doesn’t seem like something that I would expect to be a dependency of iconv.

If I hit Esc (the prompt doesn’t have a “Cancel” button, which is a bug - I wonder if by hitting Esc I am choosing the preselected option? - anyway), I get this:

And this scares me because it looks like it wants to install a different version of PHP (a lower one, actually, 8.2.4 when I already have 8.2.5 !!!) so I’m afraid I’ll end up with a huge mess.

So I have aborted that.

So my question is: what’s the clean way to install the iconv extension for the PHP 8.2.5 that I already have installed (which I think I installed with pacman)?

That module should be shipped by default with php package, so you don’t need to install anything. You need only uncomment one line in /etc/php/php.ini. Change

;extension=iconv

to

extension=iconv

Upgrade your system. Current php on stable branch is 8.2.6 :wink:

1 Like

Oh sh** I should have thought about that.

Worked, thanks.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.