新手无本地Drupal站点,FTP环境下如何安装Imgix模块及Composer Manager?
Hey there! I’ve dealt with this exact scenario before—working on a Drupal site with only FTP access and no local environment to run Composer commands. Let me break down the step-by-step process to get Imgix up and running with Composer Manager, using your existing themes/xyz/vendor folder.
Step 1: Install & Enable Composer Manager First
Since Imgix depends on Composer Manager, we need to get that set up first:
- Grab the latest stable version of Composer Manager (matching your Drupal core version) from its official Drupal project page.
- Upload the zip file to your site’s modules directory via FTP—this is usually
sites/all/modulesormodules/contribdepending on your site structure. - Unzip the file, making sure the folder is named
composer_manager(no extra version numbers in the folder name!). - Log into your Drupal admin dashboard, go to the Modules page, find Composer Manager in the list, and enable it.
Step 2: Point Composer Manager to Your Existing Vendor Folder
By default, Composer Manager looks for a vendor folder in your site’s root directory, but yours is in themes/xyz/vendor. We need to update the configuration to tell it where to look:
- Download your
sites/default/settings.phpfile via FTP to your local computer. - Add this line somewhere in the file (I usually put it near other configuration overrides):
$config['composer_manager.settings']['vendor_dir'] = 'themes/xyz/vendor'; - Save the file and upload it back to your FTP server.
Step 3: Install Imgix Module & Its PHP Dependencies
Now let’s get Imgix set up, along with its required PHP library (imgix/imgix-php):
Install the Imgix module:
- Download the latest stable Imgix module zip (matching your Drupal version).
- Upload it to your modules directory, unzip it, and make sure the folder is named
imgix. - Go back to your Drupal admin Modules page and enable the Imgix module.
Add the Imgix PHP dependency:
Since you can’t run Composer commands directly on FTP, you have two options to get the required library into yourvendorfolder:- Option 1: Local Composer Setup (Recommended)
- On your local computer, create a temporary folder. Inside it, make a
composer.jsonfile with this content:{ "require": { "imgix/imgix-php": "^2.0" } } - If you have Composer installed locally, run
composer installin this folder. This will generate avendorfolder with the Imgix library and autoload files. - Upload the
imgixfolder from your localvendordirectory tothemes/xyz/vendor/imgixon your FTP server. Also, if your existingvendorfolder doesn’t have anautoload.phpfile, upload that too.
- On your local computer, create a temporary folder. Inside it, make a
- Option 2: Manual Download
- Go to the Packagist page for
imgix/imgix-phpand download the latest stable version zip. - Unzip it, then upload the
imgixfolder inside tothemes/xyz/vendor/imgixon your FTP server. - Note: If your
vendorfolder doesn’t have an autoloader, you might need to add a line to your theme’stemplate.phpor use Composer Manager’s autoload to load the library.
- Go to the Packagist page for
- Option 1: Local Composer Setup (Recommended)
Step 4: Verify the Installation
- Log into your Drupal admin, navigate to the Imgix configuration page (usually under Configuration > Media > Imgix).
- Enter your Imgix API key and source domain, then test by uploading a sample image to see if it’s served via Imgix.
Have others used Composer Manager to install Imgix?
Absolutely! Lots of Drupal users have gone through this process, especially when stuck with FTP-only access. The biggest hurdles are pointing Composer Manager to the correct vendor directory and getting the PHP dependency uploaded properly—once those are sorted, it works smoothly.
内容的提问来源于stack exchange,提问作者Nisarg

