I have been installing osTicket on Freebds9.1 and I came across the following error message:
PHP Fatal Error: Call to undefined function utf8_encode()
I have now solved this problem. But for the benefit of others who may get experience this problem, I am posting the solution below.
To find the error I had to turn on PHP error logging which was turned off by default in my installation and then view the php log file (or log it to the syslog file and then view the Freebsd messages log file).
The error came up as:
PHP Fatal Error: Call to undefined function utf8_encode().
I checked where PHP utf8_encode() comes from. In the PHP Manual I found out that utf8_encode() is natively an item from XML Parser Functions set.
I then looked for the file xml.so in /user/local/lib/php/20050922/to find out if PHP was compiled with XML support. I found it was missing.
(if the file xml.so is in the dirrectory then check in /usr/local/etc/php/extensions.ini file to check whether xml.so extension is listed. If it is not there then add it the list of extentions - add a line with: extension=xml.so)
So I then installed the php5-xml extension using ports:
cd /usr/ports/textproc/php5-xml
make install clean
So, I added following line to the extensions.ini file to load xml extension with utf8_encode() function into the PHP:
Restart Apache and problem is fixed.