BlogOffshore Dedicated Servers

Install and Verify a LAMP Stack on Ubuntu

A LAMP installation combines Linux, Apache, MySQL and PHP, but installing the packages is only the first check. This guide uses Ubuntu 24.04 LTS distribution packages for a new test deployment. It replaces the old Ubuntu 20.04 instructions; do not run it as an in-place upgrade recipe on a live application server.

Choose a supported, compatible base

Check the Ubuntu release lifecycle and your application's PHP, extension and database requirements. Ubuntu 20.04 left standard security maintenance in May 2025; extended coverage depends on the applicable service. A supported OS alone does not establish that every installed package has the coverage you need.

Use an administrative account on a clean test host. Keep a recovery copy before changing an existing machine. If a hosting control panel manages the web stack, use its supported package workflow instead of installing a second competing stack.

Install the distribution packages

The Ubuntu PHP guide documents the Apache module and PHP database extension. Review the available package versions before accepting installation:

sudo apt update
apt-cache policy apache2 php libapache2-mod-php php-mysql mysql-server
sudo apt install apache2 php libapache2-mod-php php-mysql mysql-server

This example uses Apache's PHP module. PHP-FPM is a different integration and should not be configured blindly alongside it. The package named php follows the selected distribution's default; it is not a promise of the newest upstream PHP release.

Check each service and the actual web runtime

systemctl status apache2 mysql
php --version
php -m
sudo apache2ctl configtest

A successful CLI PHP check does not prove that Apache executes PHP. After a successful configuration check, reload or restart Apache within your maintenance window. Use a temporary test file in the intended site's document root that prints a fixed string through PHP, request it through that site's hostname, and remove it immediately afterward. Do not leave a public phpinfo() page exposing configuration details.

Configure the application database separately

Follow the Ubuntu MySQL guide for the installed release. Create the application's database and a dedicated account with only the required privileges. Keep credentials outside public files, restrict database network access, and test from the application's actual runtime. A running MySQL service does not prove the application can authenticate or query it.

Acceptance before public use

  • The intended hostname reaches the correct virtual host and PHP produces the expected response.
  • The application connects using its own database account and required extensions.
  • HTTPS, access controls and firewall exposure have been checked separately.
  • Application and database backups can be restored in a test environment.
  • Package updates, logs and recovery have an assigned operator.

If one layer fails, capture its error and service logs before changing unrelated configuration. WebCare360 publishes this guide as a hosting provider; it does not establish that server administration or application setup is included in a particular service.

This substantive revision was prepared with AI assistance using the cited sources and current service information. See our editorial policy.

Published

Offshore Dedicated Servers · Offshore VPS Servers · Streaming Servers · VPS Tutorials