Enable Recode extension in PHP 7.4 – Install Guide

by Sandeep B.

In this tutorial we’ll install Recode php extension in php 7.4. This extension is DEPRECATED and REMOVED as of PHP 7.4.  Recode library converts files between various coded character sets and surface encodings. When this cannot be achieved exactly, it may get rid of the offending characters or fall back on approximations. The library recognizes or produces nearly 150 different character sets and is able to convert files between almost any pair.

No worry we can still install Recode extension in php 7.4 follow this easy guide to this :

Step 1 :

Building and installing Recode php extension :

wget https://github.com/php/pecl-text-recode/archive/master.zip -O recode.zip
unzip recode.zip
cd pecl-text-recode-master
phpize
./configure
make
make install

** find the proper path for phpize and add prefix for the php-config eg :
suppose you’ve installed php in /opt/alt/php/ then replace this

/opt/alt/php/usr/bin/phpize
./configure --with-php-config=/opt/alt/php/usr/bin/php-config

Step 2 :

Enabling Recode php extension

In php.ini add this following line to enable Recode :

extension=recode.so

Restart apache/php-fpm/php-handler service done.

Step 3 :

Check recode is installed correctly and loaded via this command :

php -m | grep recode

If loaded successfully then result will look like :

[root@mysterydata]# php -m | grep recode
recode

Or check via php info page

If this post helps you in any way please consider a donation

Donate with PayPal :

md-donate

You may also like

1 comment

Gwyneth Llewelyn March 22, 2020 - 8:09 pm

So, why was recode deprecated?

Reply

Leave a Comment