Installing mPDF PHP library for website without root access

All we need is an easy explanation of the problem, so here it is.

I would like to install mPDF for use on my website. However, I don’t own my own server, and am using shared web hosting. I can log in using FTP, but AFAIK I do not have access to a terminal nor root access on the server.

Is there some other way to install this thing? Maybe by just copying files over using FTP? I don’t know a whole lot about Unix or Linux.

Here’s what my FTP folder tree looks like:

enter image description here

There’s more stuff at the bottom I didn’t capture.

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

To install mPDF root privileges are not required, FTP access will be sufficient and it should work fine on shared hosting environments. Simply unzip the files and subfolders and then copy them into a folder called mpdf, then you can use the mPDF library by using a line like require_once('mpdf/mpdf.php'); to load the functionality.

To clarify, mPDF is a number of PHP classes in .php files rather than a compiled binary module which must be loaded into the core PHP service/daemon. To PHP or webserver configuation changes will be required unless a prerequisite PHP module is not loaded or misconfigured.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply