# **Installing and Using `wkhtmltopdf` / `wkhtmltoimage` on Hostinger (and Similar Shared Hosting)**
*(Tested as of August 8, 2025)*
If you’re using Laravel with Snappy PDF (or similar) on Hostinger or another shared hosting service, follow these steps to set up `wkhtmltopdf` and `wkhtmltoimage`:
----------
### **1. Download the Linux Binary**
Download the precompiled Linux binary from the official GitHub releases page:
<https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz>
----------
### **2. Extract the Files**
- On your local machine, extract the `.tar.xz` file using **WinRAR** or similar (Run as Administrator).
- Inside the extracted folder, locate the `bin` directory.
It should contain the ff. files:
```
wkhtmltoimage
wkhtmltopdf
```
----------
### **3. Upload to Your Project**
Upload the `bin` folder to your Laravel project on Hostinger via FTP.
**Example sturcture:**
```
/your-laravel-project/
├── app
├── bin
│ ├── wkhtmltopdf
│ └── wkhtmltoimage
├── config
├── public
...
```
----------
### **4. Configure Snappy in Laravel**
In your Laravel config (`config/snappy.php` or similar):
```
'binary' => env('WKHTML_PDF_BINARY'),
```
Then, in your `.env` file:
```
WKHTML_PDF_BINARY=/home/u000000000/domains/your-domain.com/binary/wkhtmltox/bin/wkhtmltopdf
WKHTML_IMG_BINARY=/home/u000000000/domains/your-domain.com/binary/wkhtmltox/bin/wkhtmltoimage
```
----------
### **5. Set Permissions**
Via SSH (PuTTY), run:
```
chmod +x /home/u000000000/domains/your-domain.com/binary/wkhtmltox/bin/wkhtmltopdf
chmod +x /home/u000000000/domains/your-domain.com/binary/wkhtmltox/bin/wkhtmltoimage
```
----------
### **6. Test the Installation**
Verify the permission, run the ff. commands via SSH (PuTTY):
```
/home/u000000000/domains/your-domain.com/binary/wkhtmltox/bin/wkhtmltopdf --version
/home/u000000000/domains/your-domain.com/binary/wkhtmltox/bin/wkhtmltoimage --version
```
----------
### **7. Clear Laravel Caches**
Run these commands to ensure Laravel uses the updated configuration:
```
php artisan view:clear
php artisan cache:clear
php artisan optimize:clear
```
----------
**Done!** You can now use `wkhtmltopdf` and `wkhtmltoimage` within your Laravel system on Hostinger or similar shared hosting.
# **Installing and Using `wkhtmltopdf` / `wkhtmltoimage` on Hostinger (and Similar Shared Hosting)**
*(Tested as of August 8, 2025)*
If you’re using Laravel with Snappy PDF (or similar) on Hostinger or another shared hosting service, follow these steps to set up `wkhtmltopdf` and `wkhtmltoimage`:
----------
### **1. Download the Linux Binary**
Download the precompiled Linux binary from the official GitHub releases page:
https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
----------
### **2. Extract the Files**
- On your local machine, extract the `.tar.xz` file using **WinRAR** or similar (Run as Administrator).
- Inside the extracted folder, locate the `bin` directory.
It should contain the ff. files:
```
wkhtmltoimage
wkhtmltopdf
```
----------
### **3. Upload to Your Project**
Upload the `bin` folder to your Laravel project on Hostinger via FTP.
**Example sturcture:**
```
/your-laravel-project/
├── app
├── bin
│ ├── wkhtmltopdf
│ └── wkhtmltoimage
├── config
├── public
...
```
----------
### **4. Configure Snappy in Laravel**
In your Laravel config (`config/snappy.php` or similar):
```
'binary' => env('WKHTML_PDF_BINARY'),
```
Then, in your `.env` file:
```
WKHTML_PDF_BINARY=/home/u000000000/domains/your-domain.com/binary/wkhtmltox/bin/wkhtmltopdf
WKHTML_IMG_BINARY=/home/u000000000/domains/your-domain.com/binary/wkhtmltox/bin/wkhtmltoimage
```
----------
### **5. Set Permissions**
Via SSH (PuTTY), run:
```
chmod +x /home/u000000000/domains/your-domain.com/binary/wkhtmltox/bin/wkhtmltopdf
chmod +x /home/u000000000/domains/your-domain.com/binary/wkhtmltox/bin/wkhtmltoimage
```
----------
### **6. Test the Installation**
Verify the permission, run the ff. commands via SSH (PuTTY):
```
/home/u000000000/domains/your-domain.com/binary/wkhtmltox/bin/wkhtmltopdf --version
/home/u000000000/domains/your-domain.com/binary/wkhtmltox/bin/wkhtmltoimage --version
```
----------
### **7. Clear Laravel Caches**
Run these commands to ensure Laravel uses the updated configuration:
```
php artisan view:clear
php artisan cache:clear
php artisan optimize:clear
```
----------
**Done!** You can now use `wkhtmltopdf` and `wkhtmltoimage` within your Laravel system on Hostinger or similar shared hosting.