Skip to content
Advertisement

Server document root and folder in different machines

I am using tDPDF to use unicode font. The problem is that i am creating my web page using xampp, testing on Raspberry Pi LAMP server and uploading on my server. All of them have different server document root address which it is causing an error on a unicode file(php). It has the following line

Xampp File

$ttffile='C:xampphtdocsapp-finalfpdf/font/unifont/Calibri.ttf';

I must change it to something that it will work to all my address, like

C:xampphtdocsapp-final
192.168.1.10/html/
172.20.10.1/www/

I tested the following but missing the folder in each machine(app-final, html, www, etc…)

$ttffile=$_SERVER["DOCUMENT_ROOT"] . "/fpdf/font/unifont/Calibri.ttf";

My links so far:

C:xampphtdocsapp-finalfpdf/font/unifont/Calibri.ttf
192.168.1.10/   html/     fpdf/font/unifont/Calibri.ttf
172.20.10.1/    www/      fpdf/font/unifont/Calibri.ttf

Advertisement

Answer

It was so simple

$ttffile= __DIR__ . "/Calibri.ttf";
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement