Php – Function utf8_encode undefined

PHP

I have Ubuntu 16.04 installed, which comes with PHP 7 by default; but I ended up installing PHP 5.6 as well, and I have apache using 5.6.

When I went to run a project of mine, it told me the following:

PHP Fatal error: Call to undefined function utf8_encode()

I read through a bunch of posts where others have had this issue, and tried installing different extensions; but nothing has helped.

My understanding, was that that function would be packed with PHP (4,5,7) by default.

Any ideas?

* Update *

I did try the following, and it came back false.

var_dump(is_callable('utf8_encode'));

Here are the installed mods/extensions:

[PHP Modules]
calendar
Core
ctype
date
dom
ereg
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zlib

[Zend Modules]
Zend OPcache

Best Answer

on ubuntu :

sudo apt-get install php5.6-xml 
sudo service apache2 restart
Related Topic