• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Resolved Problems loading Composer autoload.php

cloudNiner

New Pleskian
Server operating system version
Ubuntu 22.04
Plesk version and microupdate number
18.0.63 #4
I have migrated my site from a shared server to a Plesk-managed VPS and am trying to get my php scripts using PHPMailer to work. I installed PHPMailer using Composer from a shell, following articles on how to use it with Plesk. My problem is getting the Composer-generated autoload to work:
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require '/root/vendor/autoload.php';

Composer installed autoload in /root/vendor, which might be the problem. Should it go elsewhere? After turning off open_basedir and adding /root/vendor to the include path, I get this in error_log:
PHP Warning: require(/root/vendor/autoload.php): Failed to open stream: Permission denied in /var/www/vhosts/photomungus.com/httpdocs/registrationForm.php on line 15; PHP message: PHP Fatal error: Uncaught Error: Failed opening required '/root/vendor/autoload.php' (include_path='.:/opt/plesk/php/8.3/share/pear; /root/vendor') .

What is the right way to do it?
 
I got this to work by running Composer from my project directory. It places the files in the location from which you invoke it.
 
Back
Top