dompdf
, TCPDF
, or phpmailer
– you’re in luck.This guide shows you how to install Composer dependencies per customer/project, safely and cleanly – without interfering with the system or other sites.No root-level system installs. No conflicts. Just Composer the way it’s meant to be used.
📦 Composer per Customer on Plesk
Here’s a simple 4-step setup to install any Composer package per customer domain. We’ll use tenbyte.de
as an example, but you can replace that with your customer’s domain.
Step 1: Go to the customer’s web root
cd /var/www/vhosts/tenbyte.de/httpdocs/
Step 2: Run Composer with the desired PHP version
/opt/plesk/php/8.3/bin/php /opt/psa/var/modules/composer/composer.phar require dompdf/dompdf
You can replace dompdf/dompdf
with any package you need, like phpmailer/phpmailer
, guzzlehttp/guzzle
, etc.
⚠️ Composer might warn about running as root.
Step 3: Fix permissions
After the installation, make sure your files are owned by the correct system user:
chown -R tenbyte.de_user:psacln /var/www/vhosts/tenbyte.de/httpdocs/
find /var/www/vhosts/tenbyte.de/httpdocs/ -type d -exec chmod 755 {} \;
find /var/www/vhosts/tenbyte.de/httpdocs/ -type f -exec chmod 644 {} \;
You can check the correct system user with:
ls -la /var/www/vhosts/tenbyte.de/
🧪 Optional: Test your Composer package
If you’re installing dompdf
, here’s a simple test script you can drop into the customer’s web folder:
<?php
require 'vendor/autoload.php';
use Dompdf\Dompdf;
$dompdf = new Dompdf();
$dompdf->loadHtml('<h1>Hello from DomPDF!</h1>');
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$dompdf->stream("example.pdf", ["Attachment" => false]);
Open it in your browser:https://tenbyte.de/test-pdf.php
🔐 Safe by Design
This approach ensures:
- ✅ Composer stays project-local
- ✅ No system-wide conflicts
- ✅ Files remain under customer control
- ✅ Safe for shared hosting environments
For added security, you can lock down access with open_basedir
inside Plesk’s PHP settings.
💡 Bonus Tips
- 🧩 Works with all Composer packages (Guzzle, Monolog, PHPMailer, TCPDF, etc.)
- 🛠️ Composer commands are run via PHP binary from Plesk
- 📁 Vendor folder stays inside the customer’s space
- 📦 Updates via
composer update
are easy
🚀 Final Thoughts
Composer is the backbone of modern PHP development – and with Plesk, you can use it in a safe, isolated, and professional way for each of your clients.
Give your customers the power of packages like dompdf, guzzle, or twig without compromising your server setup.
It’s simple, elegant, and under your control – just the way it should be.
Need a pre-made script or more automation? Feel free to get in touch with us.