Skip to content

Product docsWeb hosting

Install Joomla, Drupal, PrestaShop, OpenCart, Moodle or Laravel on web hosting

Install a PHP CMS, store or Laravel app on Linux web hosting: set the PHP version, create the database, upload the files, run the installer, then lock it down.

  • Beginner
  • 25 min read
  • Updated

This guide is not available in your language yet, so it is shown in English.

On this page
  1. Before you start
  2. Step 1: Choose the folder the site runs from
  3. Step 2: Set the PHP version and extensions
  4. Step 3: Create the database
  5. Step 4: Upload the files
  6. Step 5: Run the web installer
  7. Step 6: Finish and lock it down
  8. Step 7: Add cron jobs
  9. Laravel on web hosting
  10. Troubleshooting
  11. Next steps

Most PHP applications install the same way on Linux web hosting: choose the PHP version, create a database, put the files in the right folder and run the application's web installer. This guide gives those steps for any control panel, such as cPanel or Plesk (your package shows which one), and the extra steps Joomla, Drupal, PrestaShop, OpenCart, Moodle and Laravel need.

Before you start

Step 1: Choose the folder the site runs from

The document root is the folder a domain serves. Use the main domain's folder, or a subdomain such as shop.example.com with a folder of its own.

Two applications serve only a subfolder:

  • Moodle 5.1 and newer serve their public folder. Upload Moodle to a folder of its own, for example moodle, and set the domain's document root to moodle/public.
  • Laravel serves its public folder. Set the document root to the project's public folder.

cPanel

Open Domains, create the domain or subdomain and enter the Document Root folder. The primary domain always uses public_html, so put Moodle or Laravel on a subdomain or an addon domain.

Plesk

Open Websites & Domains, then the domain's Hosting settings (Hosting & DNS › Hosting in newer versions), change Document root and select OK or Save.

If your panel only accepts document roots inside public_html, give the application its own folder there and serve that folder from this domain only.

Step 2: Set the PHP version and extensions

Set the version for the domain and turn on the extensions the application lists: change the PHP version and PHP limits.

ApplicationPHPAlso check
Joomla 68.3 or newer, 8.4 recommendedmemory_limit of 256 MB
Drupal 118.3 or 8.4, 8.5 from Drupal 11.3
PrestaShop 9.1 and 9.28.1 to 8.5memory_limit of 512 MB; intl, gd, zip, pdo_mysql
OpenCart 48.1 or newer
Moodle 5.38.3 or 8.4memory_limit of at least 96 MB, 128 MB recommended
Laravel 138.3 to 8.5mbstring, openssl, pdo, tokenizer, xml, ctype, curl, fileinfo

Step 3: Create the database

Create a database and a database user with all privileges on it, and note the database name, the user name, the password and the host: databases and phpMyAdmin on web hosting.

cPanel

Open Manage My Databases (or Database Wizard), create the database and the user, then add the user to the database with ALL PRIVILEGES. cPanel puts your account name in front of both names, for example account_shop: the installer needs the full names.

Plesk

Open Databases and select Add Database. Enter the database name and create the database user in the same form.

The host is the one the panel shows, usually localhost.

Step 4: Upload the files

Upload the application's ZIP file to the folder from Step 1 and unpack it with the File Manager's Extract action, or unpack it on your computer and upload the files over SFTP.

  • OpenCart: upload the contents of the package's upload folder, not the folder itself. Rename config-dist.php to config.php, and admin/config-dist.php to admin/config.php.
  • Drupal: upload the release archive from drupal.org, or install it with Composer if your plan has SSH access.
  • Laravel: follow the Laravel section below instead.

Verify: the folder contains the application's files directly (for example index.php), not one more folder with the package name.

Step 5: Run the web installer

Open your domain in the browser. The installer checks the PHP version and extensions, then asks for the database details from Step 3 and an administrator account.

Moodle also asks for the data directory (moodledata). Create it in your home directory, next to the Moodle folder and never inside a folder a domain serves.

Step 6: Finish and lock it down

ApplicationAfter the installer
JoomlaIf an installation folder is left, delete it. Turn on search-engine-friendly URLs in the global configuration.
DrupalAdd your domain to $settings['trusted_host_patterns'] in sites/default/settings.php, then make settings.php read-only again.
PrestaShopDelete the install folder. The installer renames the admin folder; note its new name, because it is your back-office address.
OpenCartDelete the install folder. If the admin dashboard warns that the storage folder is inside the web root, use its button to move it.
MoodleAdd a cron job that runs Moodle's cron script every minute, with the command from Moodle's cron documentation.

The Drupal setting looks like this, with your own domain:

PHP
$settings['trusted_host_patterns'] = [
  '^example\.com$',
  '^www\.example\.com$',
];

Step 7: Add cron jobs

Many applications run tasks on a schedule: emails, indexes, cleanups. Add the command the application documents:

cPanel

Open Cron Jobs, choose how often the job runs, enter the command and select Add New Cron Job.

Plesk

Open Scheduled Tasks, select Add Task, choose Run a command, enter the command and the schedule, then select OK.

Laravel on web hosting

  1. Build the project with production packages, on the server over SSH or on your computer: composer install --no-dev --optimize-autoloader. Upload the whole project, including the vendor folder.
  2. Point the domain's document root at the project's public folder (Step 1).
  3. Create the .env file from .env.example. Set APP_ENV=production, APP_DEBUG=false, APP_URL and the database details from Step 3.
  4. Over SSH, create the application key, run the migrations and cache the configuration:
Bash
php artisan key:generate
php artisan migrate --force
php artisan optimize
  1. Make sure storage and bootstrap/cache are writable by your account.
  2. Add the scheduler as a cron job that runs every minute (Step 7), with the path to your project:
Bash
cd /home/account/myapp && php artisan schedule:run >> /dev/null 2>&1

Queue workers are long-running processes. On web hosting, process the queue from the scheduler with php artisan queue:work --stop-when-empty, or use the sync queue driver. For workers that run all the time, under Supervisor, use a VPS.

Troubleshooting

The installer stops at a missing PHP extension. Turn it on for the domain's PHP version, then reload the installer: change the PHP version and PHP limits.

Allowed memory size of … bytes exhausted. Raise memory_limit within your plan's limits (Step 2).

The installer cannot connect to the database. Use the full database and user names, including any account prefix, the host the panel shows and the user's password. Check that the user has privileges on the database.

A 500 error after the installation. See hosting 500 and 403 errors. In Laravel, check storage/logs/laravel.log.

Moodle 5.1 or newer shows an error about its public directory. The document root points at the Moodle folder instead of moodle/public. Change it as in Step 1.

Next steps

Frequently asked questions

Which applications does this guide cover?

Joomla, Drupal, PrestaShop, OpenCart, Moodle and Laravel. The same steps work for most PHP applications that ship a web installer, such as scripts bought on marketplaces.

Do I need SSH access?

No. The control panel's File Manager, database tools and cron jobs are enough for Joomla, Drupal, PrestaShop, OpenCart and Moodle. Laravel is easier with SSH, but you can also upload a project that you built on your own computer.

Which PHP version should I choose?

The newest version the application supports, from the table in Step 2. Versions that no longer get security fixes are listed on php.net.

When should I move to a VPS?

When the application needs a search engine such as OpenSearch (Magento), long-running queue workers, Node.js, or more memory and CPU than your plan offers.

Generiraj lozinku

Please confirm