I need to find a headless browser that can run on my FreeBSD shared hosting account. The browser should handle modern HTML, CSS, and JavaScript pretty well.
Since I don’t have root access and I’m not great with server stuff, I need something that doesn’t require special dependencies. Most shared hosting providers don’t have Java installed, so that rules out some options.
I want to use this for server-side rendering tasks like generating page screenshots and making AJAX content searchable by Google. A command line tool or something I can call from PHP would be perfect.
Has anyone used headless browsers on FreeBSD shared hosting before? What would you recommend for this setup?
Headless browsers on FreeBSD shared hosting can be challenging due to dependency restrictions. While Puppeteer and Playwright work well, they require Node.js which many shared hosts do not support. An effective option is wkhtmltopdf, which has FreeBSD binaries and operates self-contained, eliminating dependency issues. Although it’s primarily designed for PDFs, the wkhtmltoimage functionality is useful for generating screenshots. Additionally, PhantomJS is an alternative worth considering; it handles basic web content adequately and can be easily executed from PHP using shell_exec. Though these tools might not support the latest web standards like Chrome-based alternatives, they are suitable for server-side rendering tasks and indexing content in Google.
phantomjs worked well for me on freebsd shared hosting. just download the static binary, chmod +x it and ur set. it handles most modern stuff fine and u can script it with simple js files, then call from php using exec(). not as fancy as chrome headless but gets the job done for screenshots and basic ssr without needing root or extra dependencies.
I hit this same problem two years ago with a FreeBSD host. Tried a bunch of stuff and ended up with html-pdf - it’s PhantomJS-based but comes as a standalone binary. Best part? No Node.js needed. Just upload the FreeBSD binary and call it straight from PHP. For screenshots, I’d curl the page content first, then pipe it through the headless browser. Worked pretty reliably. The rendering isn’t as sharp as Chrome-based tools, but it handles most JS and CSS fine for SEO work. Watch your memory usage though - shared hosts are picky about limits. You might need basic queuing if you’re processing multiple pages at once.