Hey so im getting a - Fatal error: "Uncaught Error: Call to undefined function utf8_encode() in"

433 views Asked by At

VPS Info:

Debian Stretch 9

Packages Installed: https://hastebin.com/erugofatab.apache

Services Running: https://hastebin.com/nekunukuza.cs

Okay so im having issues with utf8_encode php, when clicking on a part of my website I got the error, I was moving website files from one vps to another, so I know the website works on my other vps.

Fatal error: Uncaught Error: Call to undefined function utf8_encode() in /var/www/html/cogs/teamspeak/Helper/String.php:472 Stack trace: #0 /var/www/html/cogs/teamspeak/Adapter/ServerQuery.php(204): TeamSpeak3_Helper_String->toUtf8() #1 /var/www/html/cogs/teamspeak/Node/Abstract.php(82): TeamSpeak3_Adapter_ServerQuery->prepare('login', Array) #2 /var/www/html/cogs/teamspeak/Node/Abstract.php(94): TeamSpeak3_Node_Abstract->prepare('login', Array) #3 /var/www/html/cogs/teamspeak/Node/Host.php(802): TeamSpeak3_Node_Abstract->execute('login', Array) #4 /var/www/html/cogs/teamspeak/TeamSpeak3.php(335): TeamSpeak3_Node_Host->login(Object(TeamSpeak3_Helper_String), Object(TeamSpeak3_Helper_String)) #5 /var/www/html/manager/tsdomaine.php(5): TeamSpeak3::factory(Object(TeamSpeak3_Helper_Uri)) #6 {main} thrown in /var/www/html/cogs/teamspeak/Helper/String.php on line 472

I checked out the files that were giving out the error "String.php on line 472" and this is on line 472 " $this->string = utf8_encode($this->string);"

These are the xml related packages I have on my vps;

  1. libxml2/stable,stable,now 2.9.4+dfsg1-2.2+deb9u2 amd64 [installed,automatic]
  2. php-xml/stable,now 1:7.0+49 all [installed,automatic]
  3. php7.0-xml/stable,stable,now 7.0.30-0+deb9u1 amd64 [installed]
  4. xml-core/stable,now 0.17 all [installed,automatic]

There are many things Im thinking that could be the issue, maybe im missing a package, maybe I have to edit something in my php config. Not sure really If someone has any idea on how to fix this please let me know thanks.

Thanks,

1

There are 1 answers

0
freshskates On

Update: After an hour of googling, Found what I was missing.

In the apache2 config "/etc/apache2/apache2.conf "

I needed to add a line which is

"AddDefaultCharset UTF-8"