Hosting Guide

Drupal Hosting: Requirements, Composer Setup on cPanel and Performance Tips

Short answer: Current Drupal needs a recent PHP 8 version, MySQL 8 or MariaDB, Composer and SSH access. Small Drupal sites run well on cPanel hosting with SSH: install with composer create-project drupal/recommended-project, point the domain’s document root at the web folder, and turn on Drupal’s page caches. Larger sites with many editors or heavy traffic are better on a Cloud VPS with Redis and a CDN.

What Drupal needs from hosting

Requirement Details
PHP A current PHP 8 version. Drupal 11 needs PHP 8.3 or newer; check the requirements for your exact release.
Database MySQL 8 or a supported MariaDB version (PostgreSQL and SQLite are also supported)
Composer The standard way to install Drupal, modules and updates
SSH access Needed for Composer and the Drush command-line tool
PHP memory At least 256 MB for most sites; more for large sites and imports
Web server Apache with mod_rewrite, or Nginx with Drupal’s rules

Check the system requirements page on drupal.org before you choose a plan, because they change with each major release.

Which hosting suits which Drupal site

Site Suggested hosting
Brochure site or blog with few editors cPanel web hosting with SSH access
Busy site, many logged-in users, or large content Cloud VPS with Redis and a CDN
Several large Drupal sites or high traffic Larger Cloud VPS or a dedicated server

Install Drupal with Composer on cPanel

  1. Turn on SSH access for the account (or use the Terminal in cPanel).
  2. Create a database and user in MySQL Databases.
  3. Create the project in your home folder, outside public_html:
cd ~
composer create-project drupal/recommended-project example.com
cd example.com
composer require drush/drush
  1. In Domains > Domains, set the domain’s document root to example.com/web.
  2. Open the domain in your browser and finish the installer with the database details.
  3. Set the trusted host patterns in web/sites/default/settings.php.
$settings['trusted_host_patterns'] = [
  '^example\.com$',
  '^www\.example\.com$',
];

Softaculous can also install Drupal in a few clicks, but a Composer-based install is easier to keep updated.

Keep Drupal updated

Drupal publishes security advisories for core and modules. Update promptly:

composer update "drupal/core-*" --with-all-dependencies
vendor/bin/drush updatedb
vendor/bin/drush cache:rebuild

Take a backup of the files and database first, and test updates on a copy of the site for major versions.

Move an existing Drupal site

  1. Put the old site in maintenance mode, then export the database and copy the whole project folder, including vendor or the Composer files to rebuild it.
  2. Create the database on the new hosting and import the dump.
  3. Update the database details in settings.php, and the trusted host patterns if the domain changes.
  4. Copy the sites/default/files folder, which holds uploaded files.
  5. Clear the cache with Drush, then test with the hosts file before you change DNS. See our hosts file guide.

Make Drupal fast

  • Keep the Internal Page Cache and Dynamic Page Cache modules turned on.
  • Turn on CSS and JavaScript aggregation in Configuration > Performance.
  • Use Redis for Drupal’s cache on busy sites. See our guide to Redis Manager for cPanel.
  • Serve images through image styles in modern formats, and use a CDN for visitors far from the server.
  • Use the newest PHP version your Drupal release supports.

Security basics

  • ✓ Subscribe to Drupal security advisories and apply updates quickly.
  • ✓ Keep settings.php read-only (444 or 440) once the site is installed.
  • ✓ Remove modules you do not use.
  • ✓ Use strong passwords and two-factor authentication for administrators.
  • ✓ Keep daily off-site backups of files and the database.

For file permissions in general, see our cPanel file permissions guide.

Need help with this?

Building with Drupal? Start on our hosting with SSH access, or a Cloud VPS for larger sites.

See Cloud VPS plansContact @CustomerPanel

Frequently asked questions

Can I run Drupal on shared hosting?

Yes, for small and medium sites, as long as the plan offers SSH access and a current PHP version for Composer and Drush.

Why should the document root point to the web folder?

The recommended project keeps code and libraries outside the public folder. Only the web folder should be reachable from the internet.

How do I update Drupal?

Use Composer to update core and modules, then run drush updatedb and clear the cache. Back up first.

Does Drupal need Redis?

Not for small sites. Busy sites with many logged-in users benefit from Redis for the cache.

Can I install Drupal with Softaculous?

Yes, but a Composer-based install is easier to maintain and update over time.


Sources