Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Function utf8_encode undefined

Tags:

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

like image 330
xil3 Avatar asked Jul 12 '16 19:07

xil3


2 Answers

on ubuntu :

sudo apt-get install php5.6-xml 
sudo service apache2 restart
like image 110
sj59 Avatar answered Oct 12 '22 23:10

sj59


The following fixed it:

sudo a2enmod xml2enc

like image 39
xil3 Avatar answered Oct 12 '22 22:10

xil3