Generating PDFs with PHP using (PDF)LaTeX [closed]

I am preparing for my students some tests that should be generated by PHP on a webhosting. I have stored latex-source codes in database and I would like to get PDF together using PDFLaTeX. Is there any solution for that? I can not find anything from PHP.

The obvious answer would be to generate the tex-file and then use shel_exec with texlive install on my machine. But since it is on the webhosting where I can not install texlive, I can’t do that in general.

If it is not with PHP, is there any change to use some JavaScript libraries on frontend to generate PDF for download?

Thank you.