1

I'm trying to install Craft v3 on a web server currently running Craft 2. As far as I am aware all the required PHP extensions (including iconv) are installed; PHP v7.1.x

The front end works OK, but as soon as I go to the control panel I get this (devmode=true)

> PHP Notice – yii\base\ErrorException iconv(): Wrong charset,
> conversion from `UTF-8' to `UTF-16BE' is not allowed

I should note that my method of installation involves getting the site working on a local machine and then copying everything over, and editing the .ENV and general.php accordingly. There is no added content or plugins installed - just an empty Craft install (latest version).

As far as I can see the database charset is set up correctly (UTF8).

What else should I be looking at?

UPDATE: digging around further, if I run a PHP test file, this line

> $res=iconv('utf-8', 'UTF-16BE', 'test1');

throws the same error message. So I am guessing it is a server problem.

1
  • Just a guess, but your web server is configured to use UTF-16BE, but the version of iconv you have installed doesn't support it?
    – Brad Bell
    Jun 18 '19 at 22:31
1

I'm going to attempt to answer my own question now that I have had the issue resolved. Clearly this is a local server environmental issue. The explanation I have received from the hosting provider is not one I understand too well, but here it is for the record.

For security reasons, the PHP FPM process on your server executes scripts in a separate chroot(2) environment, meaning that only a limited set of resources are available at runtime. This sometimes causes problems when the chrooted program requires resources that don't exist outside the chroot environment that are loaded during runtime rather than being built in to the binary, or dynamically linked before the system chroot call. The iconv extension has this problem, in loading .so binary data files corresponding to the encodings it's manipulating. On your server, the files it loads were in /usr/lib/x86_64-linux-gnu/gconv, and had not been copied into the chroot environment at /srv/php-fpm/rdc. Copying the contents of /usr/lib/x86_64-linux-gnu/gconv to /srv/php-fpm/rdc/usr/lib/x86_64-linux-gnu/gconv has fixed the issue.

2
  • Exactly what I was about to suggest. ;)
    – Brad Bell
    Jun 18 '19 at 22:42
  • Thanks @brad-bell. I knew you had it in hand! Jun 19 '19 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.