Tuesday, 24 November, 2020
Installing PHP Composer Dependencies with Plesk
How to Install Composer Packages on Plesk without Shell Access
Who Should Read This
Anyone hosting websites on a Plesk hosting platform, who doesn't have SSH remote access, and deploys Composer components over FTP\SFTP\SCP\WebDAV.
This post describes a quick way to install Composer dependencies on Plesk.
Composer is used in PHP projects to log, track and pull-in 3rd party components: typically when a project is first installed
composer install is run to install the necessary packages; you can find our more about Compose and how to use it at https://getcomposer.org/doc/01-basic-usage.md.
Often websites are deployed to Plesk using a simple, manual file upload or by pulling in a GIT repository, but uploading the 3rd party components can take an age, and they shouldn't be included in the GIT repository (for faster pull down), but, because most hosting providers lock down Plesk to prevent command line access, many users feel they have no choice.
I'm here to tell you there's a better way: This article demonstrates - on Plesk Onyx 17.8.11 - how to install and update Composer components using the
composer.json file when you don't have command line access.
Step 1: Find your the Composer.json files.
Login in to Plesk, click Applications on the left hand-side menu, and then click the Scan button.
Plesk will go off and search for all the composer.json files on your hosting environment.
When it's finished, click the composer.json file of the website you want to install the components on; it will show the path of files so you'll be able to see which composer.json belongs to which website.
In the image below the name and installation path shown are for a test Laravel project on a test subdomain.
Step 2: Install the Dependencies
Click Install Dependencies to run
Composer Install and create the /vendor folder.
Once finished Plesk will report back on the success or failure of the install in a pop up in a dialog; you can review any issues, apply fixes and rerun the install as necessary - you're most likely going to run in to file permission issues or composer dependency issues.
Step 2: Updating the Dependencies
You can also Update Dependecies, which will run
Composer Update instead of
Step 3: Amending Composer.json
Finally, if you feel the need, you can Edit the
composer.json directly on the server using the Edit Configuration option,
Don't waste time waiting for Composer components to upload. Your hosting providers download connection is much faster than your upload connection, use Plesk's built in Composer features instead.
Want to Thank Me?
Did you like the article? Was it helpful? If so why not buy me a coffee using Paypal? Buy me a coffee at https://www.paypal.me/justaguycoding