Skip to main content
1 minute
Cannot set $PATH Variable for composer in cPanel as required by the new Drupal CMS to enable auto updates

With the Launch of the new Drupal CMS V1 on January 15th 2025, excitement was allover the place with the notable new features like Automatic Updates built into the core.

On my first try i ran into this error;

The composer executable cannot be found. Make sure it's installed and in the $PATH to enable auto updates.

The challenge was the shared cPanel hosting i was using. Drupal CMS specifically requires composer to be installed under /usr/bin/composer, a feature normally common with dedicated servers.

cPanel characteristically installs Composer under /opt/cpanel/composer/bin/composer for shared servers and it cannot be changed

The solution for this is to set the $PATH under package manager settings using Drush via the following command;

$ php /home/<cpanel-user-name>/<cms.example.com>/vendor/drush/drush/drush cset package_manager.settings executables.composer /opt/cpanel/composer/bin/composer

$ php /home/<cpanel-user-name>/<cms.example.com>/vendor/drush/drush/drush is equivalent to just typing the command drush (which should already be installed on your server)

The final command to use in your command line will be;

$ drush cset package_manager.settings executables.composer /opt/cpanel/composer/bin/composer