mPDF error: Unable to create output file
Try not to modify the source. Instead, revert back to fopen($file_out,'wb');
and make sure that folder permissions are set to 0777
, like you did.
Also, check if you're using the absolute path in order to write to a file, rather than using relative paths or even worse, URL.
So,
$file = "/var/www/html/mywebsite/mypdfs/myfile.pdf";
and try if it works.
Good luck!
Fahad Khan
An experienced programmer having following skills Web fundamentals like HTML, JavaScript, and CSS CSS preprocessors like Sass or LESS JavaScript frameworks/libraries like AngularJS, React, JQuery etc., or JS-based build tools like Grunt, Gulp, Bower and NPM Front-end (CSS) frameworks like Foundation or Bootstrap API design and development Server-side languages like PHP, NodeJS Database technologies like MySQL, PostgreSQL, and MongoDB. Web server technologies like Node.js, Apache, Nginx Frameworks related to their server-side language of choice like Express, Laravel Testing tools like Mocha, Chai, Protractor, Jasmine
Updated on November 28, 2020Comments
-
Fahad Khan over 3 years
I am Using mPDF to generate pdf from an html.
On my localhost the pdf is generated to the located directory successfully. But not on Server, although I have open the permissions of that directory.
chmod -R 0777 /mydirectory
Found this comment from an answer and changed
fopen($file_out,'wb');
tofopen($file_out,'w+');
in mpdf.phpBut no success.
Thanks for any help.