October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Laravel

How to Fix Laravel Snappy When the PDF File Is Not Created

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If Laravel Snappy reports that a PDF file “was not created,” the failure is usually outside your Blade template: the PHP process could not find, start, execute, or write the separate wkhtmltopdf program. Verify that executable from the same host and account that runs Laravel, then check Snappy’s configured path, permissions, operating-system compatibility, command output, and local-file settings in that order.

What the error actually means

Laravel Snappy is a Laravel wrapper around KnpLabs Snappy, which launches the external wkhtmltopdf executable. Snappy does not itself render HTML into a PDF. Therefore, “The file … was not created” only proves that the expected output file was absent after the command finished; it does not identify whether the binary was missing, refused to start, lacked a library, lacked permission, used the wrong architecture, failed to load the page, or could not write the destination.

Start with the host, binary and execution account before changing a view. A command-line failure points first to installation, path, runtime dependencies, executable permission or binary compatibility—not to Blade syntax.

1. Run the configured wkhtmltopdf directly

  1. Log in to the production host or container that runs PHP. Do not test on your laptop when the exception occurs on a queue worker, web server or container.
  2. Find the exact path configured for the PDF driver in config/snappy.php.
  3. Run that path with a version check and a tiny conversion as the same operating-system user used by PHP.
/absolute/path/to/wkhtmltopdf --version
printf '<html><body>probe</body></html>' > /tmp/probe.html
/absolute/path/to/wkhtmltopdf /tmp/probe.html /tmp/probe.pdf
ls -l /tmp/probe.pdf

If the executable is not found, fix installation or the path. If it exists but will not start, inspect the reported shared-library or loader error. Laravel Snappy notes that libraries such as libXrender may need to be installed manually. If the conversion succeeds in a shell but fails through Laravel, continue with the configured path, service user, environment and output directory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
  • Convert your PDF files into Word, Excel & Co. the easy way
  • Convert scanned documents thanks to our new 2022 OCR technology
  • Adjustable conversion settings
  • No subscription! Lifetime license!
  • Compatible with Windows 11, 10, 8.1, 7 - Internet connection required

2. Inspect config/snappy.php instead of guessing the path

Publish or open the package configuration and inspect the PDF binary value actually loaded by the application. The path must point to a runnable executable on this deployment host; a path copied from a development machine is not portable.

'pdf' => [
    'enabled' => true,
    'binary' => base_path('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'),
    'timeout' => false,
    'options' => [],
],

The Composer example above is only an example. A system installation might use a path such as /usr/local/bin/wkhtmltopdf-amd64. On Windows, use the real executable path and quote it when required by the configuration. Clear Laravel’s cached configuration after changing the file:

php artisan config:clear
php artisan cache:clear

Install the Laravel integration in the project with:

composer require barryvdh/laravel-snappy

Then follow the package’s provider and configuration publishing instructions for your Laravel version. Its documentation describes package auto-discovery for Laravel 5.5 and later; verify the behavior for an older or newer application rather than assuming it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Check the PHP worker’s permissions

Executable permission

The account that runs PHP-FPM, Apache, a queue worker or a scheduler must be able to execute the binary. Check it explicitly:

Rank #2
Doxillion Free Document Converter – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
  • Convert over 50 document file formats.
  • Preview your files from Doxillion before converting them.
  • Use batch conversion to convert thousands of files at once.
  • Enjoy an easy-to-use, intuitive interface with a Drag and Drop file option.
  • Burn your converted or original files directly to disc.
namei -l /absolute/path/to/wkhtmltopdf
ls -l /absolute/path/to/wkhtmltopdf
sudo -u www-data /absolute/path/to/wkhtmltopdf --version

Replace www-data with the real service account. Composer binaries placed inside a Vagrant or other synced folder can lose executable behavior. The Laravel Snappy documentation recommends copying the binary out of that synced location and making it executable:

cp vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 /usr/local/bin/wkhtmltopdf-amd64
chmod +x /usr/local/bin/wkhtmltopdf-amd64

Exit status 126 commonly indicates that the operating system could not execute the command. It can result from permissions, a bad interpreter or an incompatible executable, so confirm the full stderr output before changing the PDF destination.

Output-directory permission

Verify the destination separately. A worker may execute wkhtmltopdf but be unable to create the requested file or its parent directory:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo -u www-data sh -c 'touch /path/to/output/.write-test && rm /path/to/output/.write-test'

Use an application-owned directory with appropriate ownership and avoid temporary paths that exist only in an interactive shell.

4. Match wkhtmltopdf to the host and architecture

KnpLabs Snappy requires wkhtmltopdf 0.12.x. Its Composer packages include i386 and amd64 static binaries, but the documentation warns that these were extracted from Debian 7 packages and may not work on non-Debian Linux distributions. A static-looking file is not proof of compatibility: the host still needs a compatible loader, libraries and CPU architecture.

Rank #3
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
  • EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
  • READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
  • CREATE, COMBINE, SCAN and COMPRESS PDFs
  • FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
  • LIFETIME License for 1 Windows PC or Laptop. 5GB MobiDrive Cloud Storage Included.
Deployment situation What to verify Safer action
Debian-like Linux Distribution release, architecture and required libraries Use a package built for that release or a tested Composer binary
Other Linux distribution Loader and shared-library compatibility Prefer a distribution-appropriate package or image
Apple Silicon ARM64 versus amd64 binary Use a native compatible build or run the tool in a compatible environment
Windows Executable path, quoting, DLL/runtime availability and service account Run the exact configured command from the same account
Container or CI image Installed libraries, architecture and filesystem permissions Install and test the renderer during image build

An issue involving an Apple Silicon Mac and the Composer wkhtmltopdf-amd64 binary illustrates architecture incompatibility; it is not a diagnosis for every Mac or Linux installation.

5. Capture the complete failing command

Before changing options, preserve the complete exception. Record:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • the full wkhtmltopdf command line;
  • exit status;
  • stderr and stdout;
  • temporary HTML and target PDF paths;
  • operating system and version;
  • Laravel Snappy and KnpLabs Snappy versions;
  • wkhtmltopdf version and installation source;
  • configured binary path and executing PHP user;
  • the smallest HTML or view that reproduces the problem.

A Windows Server report, for example, showed temporary input and output paths and an exit status but did not establish a universal cause. The message identifies the missing output, not the reason it disappeared. Reproduce with a minimal document to separate renderer startup from application data, remote assets and view logic.

6. Test Laravel’s file-generation path independently

Use a known-writable path and a minimal string to determine whether the failure occurs in the wrapper or in your view:

use BarryvdhSnappyFacadesSnappyPdf;

$html = '<html><body><h1>Snappy probe</h1></body></html>';
SnappyPdf::loadHTML($html)->save(storage_path('app/probe.pdf'));

The underlying Snappy API can also generate directly:

Rank #4
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
  • Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.
  • Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
  • Read & Annotate. Enjoy intuitive reading modes and powerful tools to comment, highlight, and mark up PDFs.
  • Create & Manage PDFs. Create new PDFs, combine multiple files, scan documents, and compress for easy sharing.
  • Fill & Sign Forms. Complete forms and digitally sign documents with secure e-signature tools.
$snappy->generateFromHtml(
    '<html><body>probe</body></html>',
    '/tmp/probe.pdf'
);

Laravel Snappy documents distinct operations: generate from HTML or a URL to a file, return PDF bytes, or send a browser download. A download or in-memory response does not prove that a filesystem file should exist. Test the operation your application actually needs.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

7. Investigate assets without weakening security

Missing CSS, images or fonts can make a PDF incomplete, but they do not justify enabling broad local-file access automatically. KnpLabs warns that --enable-local-file-access can expose local files or contribute to remote code execution when untrusted HTML or JavaScript is processed.

  • Prefer HTTPS or otherwise controlled asset URLs.
  • Use absolute, valid paths only for trusted local assets.
  • Sanitize user-provided HTML and JavaScript.
  • If local access is unavoidable, restrict the renderer’s filesystem and run it in a sandboxed, low-privilege environment.

Enable the option only for a documented, trusted use case and test the resulting command. Do not make it a global “file not created” fix.

Common symptoms and targeted fixes

Symptom Likely area Next check
wkhtmltopdf: not found Wrong path or missing installation Run the exact configured path and inspect config/snappy.php
Exit status 126 Execution permission, loader or architecture Run as the PHP user; inspect permissions and binary compatibility
Binary starts but conversion fails Missing runtime library or page-loading error Read stderr and install the required host dependencies
Shell test works, Laravel fails Different user, environment, config cache or destination Compare account, PATH, config cache and write permissions
Output path is absent Unwritable parent or invalid temporary location Create a write test as the worker and use an existing directory
PDF exists but local images are absent Asset URL or local-file policy Fix URLs first; assess tightly controlled local access only if necessary
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If the real requirement is a reliable screenshot or PDF of a web page rather than a Laravel-specific renderer, ScreenshotNeo provides a website screenshot API and MCP server. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and responses identify the result with X-Page-Verdict and X-Billed headers. Its MCP tools—take_screenshot, get_page_info and capture_pdf—work with Claude, Cursor and other MCP clients.

For a one-call image capture, see the ScreenshotNeo API documentation:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also supports full-page and element captures, device presets, retina scale, PDF paper and margin controls, custom CSS and JavaScript, waits, request blocking, headers, cookies, user agents, authorization, geolocation, time zones, transparent backgrounds, resizing, custom-TTL caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting and an OpenAPI specification. Every feature is on every plan. The Free plan includes 1,000 screenshots each month without a card; paid plans start at $5 for 3,000 screenshots.

Best Value
PDF Pro 3 - PDF editor to create, edit, convert and merge PDFs - 100% Compatible with Adobe Acrobat - for Windows 11, 10, 8.1, 7
  • ALL-IN-ONE SOLUTION – read, edit, convert, merge and protect your PDF files
  • MAXIMUM FUNCIONALITY – create interactive forms, compare PDFs, bates numbering, find and replace text or colors, convert documents, OCR engine, comment, highlight, fill out and print forms, document protection and others
  • EASY TO INSTALL AND USE – well-structured user-interface, in-program instructions, free tech support whenever you need it
  • GREAT VALUE FOR MONEY - why spend a fortune if you can have maximum functionality at a reasonable price - this also fits the requirements of companies very well

Create a free ScreenshotNeo account to try the 1,000 monthly screenshots without a card.

Operational checks before deployment

  • Pin and record the wkhtmltopdf version and installation source.
  • Run a conversion probe during image or server provisioning.
  • Test as the actual web and queue users, not only as root.
  • Use a persistent, writable output directory and monitor disk space.
  • Log command, exit status and stderr while diagnosing; remove sensitive HTML from long-term logs.
  • Keep a minimal reproducer for future upgrades and bug reports.

Frequently Asked Questions

Why does it work locally but fail on the server?

The environments may use different binary paths, CPU architectures, shared libraries, service users, configuration caches or writable directories. Compare those values on the failing host rather than copying the local path.

Should I reinstall Laravel Snappy first?

Not usually. First run the configured wkhtmltopdf executable directly and capture stderr. Reinstalling the wrapper cannot repair an absent library, incompatible binary or unwritable destination.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Is an exit status enough to diagnose the problem?

No. An exit status is a clue. The complete command, stderr, stdout, operating system, binary version and execution account are needed to select a reliable fix.

Can I solve every missing PDF by enabling local-file access?

No. That option addresses a narrow class of local-asset problems and carries security risk with untrusted HTML or JavaScript. Validate asset URLs and trust boundaries first.

Quick Recap

Bestseller No. 1
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
Convert your PDF files into Word, Excel & Co. the easy way; Convert scanned documents thanks to our new 2022 OCR technology
$29.99
Bestseller No. 2
Doxillion Free Document Converter – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
Doxillion Free Document Converter – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
Convert over 50 document file formats.; Preview your files from Doxillion before converting them.
Bestseller No. 3
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.; CREATE, COMBINE, SCAN and COMPRESS PDFs
$99.99
Bestseller No. 4
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.; Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
$99.99
Bestseller No. 5
PDF Pro 3 - PDF editor to create, edit, convert and merge PDFs - 100% Compatible with Adobe Acrobat - for Windows 11, 10, 8.1, 7
PDF Pro 3 - PDF editor to create, edit, convert and merge PDFs - 100% Compatible with Adobe Acrobat - for Windows 11, 10, 8.1, 7
ALL-IN-ONE SOLUTION – read, edit, convert, merge and protect your PDF files
$29.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.