Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange Exception while generating PDF #27

Closed
sensi opened this issue Feb 4, 2012 · 13 comments
Closed

Strange Exception while generating PDF #27

sensi opened this issue Feb 4, 2012 · 13 comments

Comments

@sensi
Copy link

sensi commented Feb 4, 2012

I've load the current wkhtmltopdf-0.9.9-OS-X.i368 from the developer page (http://code.google.com/p/wkhtmltopdf/) and install SnappyBundle as described at install guide.
Everything looks fine but when I try to generate an pdf throw the snappy bundle I got following error:

The exit status code '5' says something went wrong:
stderr: "dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
Expected in: /Applications/MAMP/Library/lib/libJPEG.dylib
in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
"
stdout: ""
command: /usr/bin/wkhtmltopdf 'http://www.google.at' '/Applications/MAMP/htdocs/cosamui/web/data/test.pdf'.
500 Internal Server Error - RuntimeException 
´´´´

When I run the some command from the terminal: command: /usr/bin/wkhtmltopdf 'http://www.google.at' '/Applications/MAMP/htdocs/cosamui/web/data/test.pdf' it works as expected.

What can I do to solve this issue? Anyone other the same problem?
@pilot
Copy link
Contributor

pilot commented Feb 4, 2012

it's look like wkhtmltopdf lib got a symbols for file name that can't processed. Try for test filename 111.jpg

@sensi
Copy link
Author

sensi commented Feb 4, 2012

thx for your respond but the problem was the missing library files...

I've now solved the above issue by coping the library files into the MAMP lib folder. After that everything looks fine but:

The exit status code '5' says something went wrong:
stderr: "dyld: Library not loaded: /Applications/MAMP/Library/lib/libiconv.2.dylib
Referenced from: /Applications/MAMP/Library/lib/libxml2.2.dylib
Reason: Incompatible library version: libxml2.2.dylib requires version 8.0.0 or later, but libiconv.2.dylib provides version 2.0.0
"
stdout: ""
command: /usr/bin/wkhtmltopdf 'http://www.google.at' '/Applications/MAMP/htdocs/cosamui/web/data/test.pdf'.
500 Internal Server Error - RuntimeException  
´´´´

@sensi sensi closed this as completed Feb 4, 2012
@sensi
Copy link
Author

sensi commented Feb 4, 2012

Ok I've fixed!

If someone get's similar exception like me, you have to check your MAMP library files under: /Applications/MAMP/Library/lib/

So in the folder above are many libs missing for the wkhtmltopdf to run correctly...
I've copy my system lib files into the MAMP lib folder and it works ;)

cp /usr/lib/* /Applications/MAMP/Library/lib/

Notice: That only works if you can run the wkhtmltopdf from the terminal successfully!

@ragulka
Copy link

ragulka commented Jun 8, 2012

@sensi, did You have any issues after copying everything from sur/lib to MAMP lib folder? I tried it but now my Apache won't even start, it doesn't even say anything is wrong in the Log.

@ragulka
Copy link

ragulka commented Jun 8, 2012

Ok, it seems that after following hints in this link (http://lists.macosforge.org/pipermail/macports-users/2010-November/022663.html) I've managed to come a buit further, but I'm stuck here:

dyld: Library not loaded: /Applications/MAMP/Library/lib/libiconv.2.dylib Referenced from: /Applications/MAMP/Library/lib/libxml2.2.dylib Reason: Incompatible library version: libxml2.2.dylib requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0

@sensi
Copy link
Author

sensi commented Jun 8, 2012

hi ragulka, no in my case it works. But I think I had luck that it works. Because on my iMac with new OS Lion I had some issues with the wkhtml stuff. This tool needs some more requirements which are not installed in an default mamp installation.

Best practice to use the wkhtmltopdf tool is, to run it on a linux installation. There I can install all required packages with yum or apt-get tool.

You also can try to install a new lamp by hand on your mac. Or try the XAMP for Mac. But I've no experience if it works on XAMP installation.

@ragulka
Copy link

ragulka commented Jun 30, 2012

Hey @sensi, I solved this by switching from MAMP to the built-in PHP/Apache in OSX Lion

@sensi
Copy link
Author

sensi commented Jun 30, 2012

Hi @ragulka I think about it, but I have to create a lot of vHosts and modify the php.ini files or disable some mod... That's all in one place and it's very comftable and fit into my workflow using MAMP.

But you're right, if I install it on the build in PHP/Apache it will work without issues...

@pakaufmann
Copy link

I had the same error as described above. I could run wkhtmltopdf from the command line just fine, but from php, with proc_open, it just produced an error code 5. The Apache logfile stated the same error as above, not finding the required libraries.
What helped in the end was to look into the environment variables set on my command line and compare it to the variables set in php.
The variable in question is named DYLD_LIBRARY_PATH, which was set to /Applications/MAMP/Library/Lib.
After setting this variable to /usr/lib, everything started to work just fine.

My command now looks something along this line:

$process = proc_open($command, $descriptorspec, $pipes, $cwd = null, array('DYLD_LIBRARY_PATH' => '/usr/lib'));

This allows wkhtmltopdf to load the system libraries, and not the MAMP specific libraries, which apparently do not work with wkhtmltopdf too well.

@sensi
Copy link
Author

sensi commented Jul 24, 2012

Thx @Kufi for your comment. Seems that works fine.

@kevindecapite
Copy link

I second @Kufi for the updated proc_open() command. Works like a charm now.

@docteurklein
Copy link
Contributor

We maybe should have a way to configure this array from bundle/snappy. Thanks for all the input by the way.

@docteurklein
Copy link
Contributor

closed by KnpLabs/KnpSnappyBundle@7540f32 and 2e6d2fb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants