Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7775805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:43:08+00:00 2026-06-01T17:43:08+00:00

I’m getting the following error while running Snappy, a PHP binding for WKHTMLTOPDF: Fatal

  • 0

I’m getting the following error while running Snappy, a PHP binding for WKHTMLTOPDF:

Fatal error: Uncaught exception 'RuntimeException' with message 'The file '/Users/username/test.pdf' was not created (command: /usr/bin/wkhtmltopdf --lowquality '/var/folders/--/--ze9OC9GTSBW3tCl6UCR++++TQ/-Tmp-/knp_snappy4f761d35744a96.74626529.html' '/Users/username/test.pdf').' in /Applications/MAMP/htdocs/includes/wkhtmltopdf/Knp/Snappy/AbstractGenerator.php:261 Stack trace: #0 /Applications/MAMP/htdocs/includes/wkhtmltopdf/Knp/Snappy/AbstractGenerator.php(117): Knp\Snappy\AbstractGenerator->checkOutput('/Users/username...', '/usr/bin/wkhtml...') #1 /Applications/MAMP/htdocs/includes/wkhtmltopdf/Knp/Snappy/AbstractGenerator.php(127): Knp\Snappy\AbstractGenerator->generate('/var/folders/--...', '/Users/username...', Array, false) #2 /Applications/MAMP/htdocs/test.php(14): Knp\Snappy\AbstractGenerator->generateFromHtml('<h1>Test</h1>', '/Users/username...') #3 {main} thrown in /Applications/MAMP/htdocs/includes/wkhtmltopdf/Knp/Snappy/AbstractGenerator.php on line 261

However, if I run what they execute via command line, it works just fine:

/usr/bin/wkhtmltopdf --lowquality '/var/folders/--/--ze9OC9GTSBW3tCl6UCR++++TQ/-Tmp-/knp_snappy4f761d35744a96.74626529.html' '/Users/username/test.pdf

Since that works just find, one would think I could execute it via the exec() function or the shell_exec() function, both of which return nothing at all (no error or anything). Executing ‘whoami’ does return my username though.

Safe mode is off and the permissions on the wkhtmltopdf file are set to 777.

I know there are a couple other threads similar to this but there were either work arounds from the initial asker that made little sense or no solution at all. Can anyone provide any insight here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:43:09+00:00Added an answer on June 1, 2026 at 5:43 pm

    Checkout this answer’s source at:
    http://oneqonea.blogspot.com/2012/04/why-does-wkhtmltopdf-work-via-terminal.html

    Within MAMP’s /Applications/MAMP/Library/bin/envvars file you’ll notice the following two lines:

    DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
    export DYLD_LIBRARY_PATH
    

    Comment both of them out as demonstrated below (note the “#” prefix on each line):

    #DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
    #export DYLD_LIBRARY_PATH
    

    Lastly, within the same file, add the following command to make sure the $PATH environment variable inherited by PHP from Apache includes the directory that contains your wkhtmltopdf executable. Your command will look something like:

    export PATH=/parent/path/of/wkhtmltopdf/executable:$PATH
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.