ScreenshotNeo

BlogHow-to

How to Use wkhtmltoimage on a Shared Hosting Server in India

Learn how to check whether wkhtmltoimage can run on your shared host, install a compatible user-owned binary, convert a page, and troubleshoot failures safely.

By the ScreenshotNeo team4 October 20268 min read

Short answer: wkhtmltoimage may run on shared hosting in India only if your provider allows shell access and execution of a user-owned binary, and the binary matches the server’s operating system, CPU architecture, and available libraries. Ask the host before installing anything. If permitted, keep the executable in an account-writable directory, verify it there, then run it with an input URL or HTML file and an output image path. Do not assume root access, compatibility with a particular Indian provider, or permission to run long rendering jobs.

1. Check whether your hosting account can run it

Shared hosting is controlled by the provider. Before choosing a binary, contact support or check your account documentation for these points:

  • Does the plan include SSH or another supported shell?
  • May you execute binaries stored in your home directory?
  • Are headless browser or HTML rendering processes allowed?
  • What process, memory, execution-time, and concurrent-job limits apply?
  • Can the account make outbound HTTPS requests to the sites you need to capture?
  • Can support help identify missing shared libraries?

Do not try to install a system package or write to system directories without administrator permission. Shared-hosting customers should not infer that they have root privileges from instructions intended for server administrators.

2. Match the binary to the server

wkhtmltoimage is a headless command-line HTML renderer built on Qt WebKit. Its headless design means it does not require a display service, but that alone does not guarantee it will run on your host: the operating system, architecture, library versions, execution policy, and host restrictions still matter. See the upstream project overview.

Ask your host how to identify the OS distribution and CPU architecture from your account, and use that information to choose a matching release asset. The project’s downloads page lists builds by operating system and architecture. It identifies 0.12.6 as the stable series, released June 11, 2020; that historical release information is not a compatibility guarantee for a current server. The upstream repository was archived in 2023, so consider its maintenance status when choosing a renderer for a new or exposed service: repository status.

If the provider permits user-installed binaries, put the executable or extracted package under a directory you can write to, such as a tool directory in your home area. Use its full path when invoking it, or add that directory to your account’s PATH using the method your host supports. Do not copy commands for a different distribution or architecture and assume they will work.

3. Verify the install and render a small example

Use the host-approved shell commands to check the version and available options. Confirm the exact executable path and consult that installed build’s help output, because switches and supported formats can differ between builds.

/home/ACCOUNT/tools/wkhtmltoimage --version
/home/ACCOUNT/tools/wkhtmltoimage --help

Replace /home/ACCOUNT/tools/wkhtmltoimage with the path where your host permits the binary to live. If the executable reports a missing library, ask the provider whether the required library is available or whether they support another build. Do not attempt privileged system changes on a shared account.

The general command syntax is wkhtmltoimage [OPTIONS] input output, as documented in the Debian wkhtmltoimage manual. These example commands illustrate that syntax; they are not a claim that a specific shared host has been tested.

# URL to PNG
/home/ACCOUNT/tools/wkhtmltoimage https://example.com page.png

# Local HTML file to PNG
/home/ACCOUNT/tools/wkhtmltoimage ./index.html page.png

After each run, check the command’s exit status and confirm that the output exists, is non-empty, and opens as the expected image. Check the installed binary’s help for its supported output formats before requesting JPEG or another format.

4. Choose rendering options deliberately

The Debian manual documents options such as --width, crop coordinates and dimensions, --zoom, --window-status, and controls for slow scripts. Availability and behavior can differ by build, so treat the installed binary’s help as authoritative for your environment.

Need What to check
Set the rendering width Check --width and how the build handles page height and scaling.
Capture a particular area Check the build’s crop coordinate and dimension options, then verify the resulting image dimensions.
Adjust page scaling Check --zoom; confirm that text and layout remain legible at the chosen value.
Wait for page scripts Check --window-status and the options for slow scripts. A page that keeps loading resources may still exceed host limits.
Select output format Use an output extension supported by the installed build and confirm the actual output file opens correctly.

Do not add switches from an online example until you have checked that your particular binary supports them.

5. Call it safely from an application

For application integration, invoke a fixed executable path, set a reasonable timeout, check the exit code, and write to a directory your account is allowed to use. Keep temporary filenames unique when requests can overlap. Avoid constructing a shell command by concatenating user-supplied URLs, filenames, or options; use your language’s process API to pass arguments separately. Restrict which URLs your application may fetch and where it may write output.

Security deserves special care. The project warns that untrusted HTML or JavaScript can create a severe server compromise risk; see its official warning. Do not send arbitrary uploaded or submitted HTML to a renderer running with access to application files or credentials. Sanitization alone should not be treated as a complete sandbox. If users can supply content, design an appropriate isolation boundary and get advice from your hosting provider before enabling rendering.

6. Troubleshoot common failures

Symptom Likely cause What to do
Permission denied The file is not executable, its directory is restricted, or the host blocks user-owned executables. Check the file path and permissions using host-approved commands. Ask support whether execution from that location is allowed; do not try to bypass provider policy.
No such file or directory for an existing binary The path may be wrong, or the binary’s required loader may be unavailable. Confirm the path and build with the host. Ask support to diagnose runtime compatibility.
Missing shared library or loader error The build expects system libraries not present on the server. Use a compatible supported build if available or ask the provider. A shared customer usually cannot install system libraries.
Exec format error or immediate crash The binary may target another OS or CPU architecture. Recheck the server OS and architecture with the provider and select a matching asset.
Timeout, killed process, or resource-limit message The page is slow or script-heavy, or the host’s execution, memory, or process limits were reached. Try a simpler page, reduce the workload, and ask the host about limits and permitted job duration. Do not assume background execution is allowed.
Blank, incomplete, or outdated capture The page may depend on scripts, delayed content, blocked network access, or state that the renderer did not wait for. Check network access and the installed build’s script and wait options. Reproduce with a simple page to separate host restrictions from page behavior.
Cannot fetch the URL Outbound requests may be blocked, DNS or TLS may fail, or the target may deny automated requests. Ask the provider whether outbound access is restricted and inspect the renderer’s error output. Do not treat a failed fetch as a successful image.
Output file is missing, empty, or the wrong format The command failed, output permissions are insufficient, or the build does not support the requested format. Check the exit code, output directory permissions, build help, and actual file type.

7. Performance, reliability, and cost considerations

Rendering time depends on the target page, its scripts and network resources, the chosen image dimensions, the binary, and the shared host’s available resources. Large or script-heavy pages can take longer and use more memory than a simple static page. Start with a controlled page, bound how long your application waits, and avoid launching overlapping jobs without knowing your provider’s process limits.

Reliability depends on more than whether the command starts: the host must allow execution, the binary must match the system libraries, and the source site must be reachable and render within the account’s limits. Treat non-zero exit codes, timeouts, and empty output as failed captures. Have your application report these separately so a failed render does not get mistaken for a valid image.

There is no general price or capacity figure for Indian shared hosting that can be established here. Check the plan’s actual process and resource limits and any provider rules for custom binaries or rendering workloads. The upstream project’s age and archived repository status are also relevant when assessing long-term maintenance and security requirements.

8. Or skip the browser setup

If your goal is an image from a URL and you do not want to manage a compatible renderer on shared hosting, ScreenshotNeo provides a website screenshot API and MCP server. It returns PNG, JPEG, WebP, or PDF from one GET request. See the API documentation for the available parameters.

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}`);
  • Cookie banners, newsletter popups, and chat widgets are removed before the shot; each cleanup step can be turned off.
  • Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed. Response headers report the page verdict and billing status.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.
  • The free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is on every plan.

Sign up for 1,000 free screenshots a month, with no card required.

9. Frequently asked questions

Does wkhtmltoimage require a graphical desktop?

The upstream project describes it as headless and says its tools do not require a display or display service. You still need a compatible binary and permission to execute it on the host.

Can I install it without root access?

Possibly, if the provider allows user-owned binaries and the build’s dependencies are available. Root access is not a substitute for provider permission, and shared-hosting compatibility must be confirmed with the host.

Is wkhtmltoimage a good default for a new service?

Review the project’s 2020 stable-series release information and 2023 repository archive status alongside your security and maintenance requirements before adopting it.

Can I render arbitrary HTML submitted by visitors?

Do not treat that as safe by default. The upstream project warns about severe compromise risk from untrusted HTML and JavaScript; use a suitable security boundary and consult the host before processing it.