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
On this page
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
- Your domain points at your hosting account and opens over HTTPS: free SSL and HTTPS on web hosting.
- The application's download from its official website, and its requirements page.
- A way to upload files: the panel's File Manager, or FTP / SFTP: upload files with FTP or SFTP.
- Replacing an existing site? Take a backup first: back up and restore your hosting account.
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
publicfolder. Upload Moodle to a folder of its own, for examplemoodle, and set the domain's document root tomoodle/public. - Laravel serves its
publicfolder. Set the document root to the project'spublicfolder.
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.
| Application | PHP | Also check |
|---|---|---|
| Joomla 6 | 8.3 or newer, 8.4 recommended | memory_limit of 256 MB |
| Drupal 11 | 8.3 or 8.4, 8.5 from Drupal 11.3 | |
| PrestaShop 9.1 and 9.2 | 8.1 to 8.5 | memory_limit of 512 MB; intl, gd, zip, pdo_mysql |
| OpenCart 4 | 8.1 or newer | |
| Moodle 5.3 | 8.3 or 8.4 | memory_limit of at least 96 MB, 128 MB recommended |
| Laravel 13 | 8.3 to 8.5 | mbstring, 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
uploadfolder, not the folder itself. Renameconfig-dist.phptoconfig.php, andadmin/config-dist.phptoadmin/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
| Application | After the installer |
|---|---|
| Joomla | If an installation folder is left, delete it. Turn on search-engine-friendly URLs in the global configuration. |
| Drupal | Add your domain to $settings['trusted_host_patterns'] in sites/default/settings.php, then make settings.php read-only again. |
| PrestaShop | Delete the install folder. The installer renames the admin folder; note its new name, because it is your back-office address. |
| OpenCart | Delete the install folder. If the admin dashboard warns that the storage folder is inside the web root, use its button to move it. |
| Moodle | Add 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:
$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
- 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 thevendorfolder. - Point the domain's document root at the project's
publicfolder (Step 1). - Create the
.envfile from.env.example. SetAPP_ENV=production,APP_DEBUG=false,APP_URLand the database details from Step 3. - Over SSH, create the application key, run the migrations and cache the configuration:
php artisan key:generate
php artisan migrate --force
php artisan optimize- Make sure
storageandbootstrap/cacheare writable by your account. - Add the scheduler as a cron job that runs every minute (Step 7), with the path to your project:
cd /home/account/myapp && php artisan schedule:run >> /dev/null 2>&1Queue 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
- Keep copies of the files and the database: back up and restore your hosting account.
- Moving a site from another host: move a website without downtime.
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.