Your Location is: Home > Php
Server document root and folder in different machines
Question
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:\xampp\htdocs\app-final\fpdf/font/unifont/Calibri.ttf';
I must change it to something that it will work to all my address, like
C:\xampp\htdocs\app-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:\xampp\htdocs\app-final\fpdf/font/unifont/Calibri.ttf
192.168.1.10/ html/ fpdf/font/unifont/Calibri.ttf
172.20.10.1/ www/ fpdf/font/unifont/Calibri.ttf
Best answer
It was so simple
$ttffile= __DIR__ . "/Calibri.ttf";