I have created a view that takes as an argument the name of a user and prints out his profile.
Now when a user is registered I have a rule and I save the pdf to the server before sending it as an attachment with Mime Mail.
I started testing it on a windows pc with xampp and it worked great.
I then moved it to the production server (linux) and I get a blank page with this error:
TCPDF ERROR: Unable to create output file: sites/default/files/private/registration/pdf/oneo/test.pdf
I went back to my local site and I get the same error. I don't know what might have changed. Is there any way to get some debug info? I can't find anything on logs.
The only thing logged by drupal is this:
Warning: fopen(sites/default/files/private/registration/pdf/oneo/test.pdf) [function.fopen]: failed to open stream: No such file or directory in TCPDF->Output() (line 8629 of ...\sites\all\libraries\tcpdf\tcpdf.php).
I have already made sure the folder path is right.
I made sure its a relative path.
I checked if any fopen, or php safe mode were enabled on the server
I checked the folder permissions.
The view is working.
I even tried other folders (just in case because I am trying to save it to the private filesystem)
Nothing works. And what's weird is I can't make it work on the local site anymore.
The only relevant issue I have found is on this comment and has to do with folder permissions [#comment-5366756]
I would be grateful if you could point me at least to the right direction as to where to look for the problem.
Comments
Comment #1
cadoughe CreditAttribution: cadoughe commentedI'm having the same problem. Following.
Comment #2
hanspln CreditAttribution: hanspln commentedI'm also getting this one, anyone found out how to fix?
Comment #3
hanspln CreditAttribution: hanspln commentedI'm also getting this one, anyone found out how to fix?
Comment #4
hanspln CreditAttribution: hanspln commentedNot exactly sure what happened, but now it works.
The paths for me are as follows:
Save pdf:
sites/default/files/[replacement]
Send PDF
sites/default/files/[replacement].pdf
Note the lack of extension on Save.
Comment #5
hanspln CreditAttribution: hanspln commentedWhen using private files it seems I had to append the PDF extension to both, so:
Save pdf:
../private/savepdf/[replacement].pdf
Send PDF
../private/savepdf/[replacement].pdf
Comment #6
lsolesen CreditAttribution: lsolesen commentedComment #8
PhilYprivate://[pdf-folder]/[filename].pdf
allows for me to follow the private folder setting whether I am using the dev or the production website.Comment #9
maxplus CreditAttribution: maxplus commentedHi,
I had to downgrade my TCPDF version because with the version I was working with (6.2.6), it was impossible to get it working.
Maybe a newer version also works, but now I'm using 6.0.020.
My path is set like this
sites/default/files/pdf
The permissions on the pdf folder are 755
Comment #10
rakesh.nimje84@gmail.com CreditAttribution: rakesh.nimje84@gmail.com commented#9 worked for me.
Thanks maxplus.
Comment #11
massiws CreditAttribution: massiws commentedHi,
I also getting this one on a (Linux) local machine.
My download path: sites/default/files/my_pdfs - TCPDF version: 6.2.11;
Downgrade TCPDF to 6.0.020 (as suggested in #9) don't fix the problem.
I found a workaround:
1) change owner and group of my_pdfs folder to www-data (previously I created it with mkdir, so it has my user and group);
2) edit tcpdf_static.php file:
as described here.
Hope this helps,
Max.
Comment #12
maxplus CreditAttribution: maxplus commentedHi,
for me using TCPDF 6.2.13 I changed my tcpdf_static.php file like this to be able to write a pdf file:
Comment #13
amirimran CreditAttribution: amirimran commentedI had the same problem and taking help from #11 i was able to fix this without hacking tcpdf library. I am on tcpdf 6.2.13
(example data from Ubuntu 16.04, with a project folder name mysite and user devel inside group devel, i am assuming apache is running with www-data group and user)
1. Check who owns the project folder in question.
ls -ld /var/www/html/mysite
Lets assume that is devel inside group devel
2. Add www-data user to group devel
sudo adduser www-data devel
3. Update owner and folder permissions for www-data
sudo chown -vR :www-data /var/www/html/mysite/
sudo chmod -vR g+w /var/www/html/mysite/
Comment #14
lephleg CreditAttribution: lephleg commentedStep [3] of #13 solved this for me. (TCPDF v6.2.12)