DeveloperBreeze

How to Install PHP, MySQL, and phpMyAdmin on Ubuntu 25.04 (LAMP Stack Setup Guide)

Step 1: Update Package Index

Begin by updating your package index to ensure you have the latest information on available packages:

sudo apt update

Step 2: Install PHP and Required Extensions

Ubuntu 25.04 includes PHP 8.3 in its official repositories. Install PHP along with commonly used extensions for Laravel:

sudo apt install php php-cli php-mbstring php-xml php-bcmath php-curl php-mysql php-zip php-gd php-fpm unzip

Verify the PHP installation:

php -v

Step 3: Install MySQL Server

Install the MySQL server package:

sudo apt install mysql-server

Secure your MySQL installation:

sudo mysql_secure_installation

This script will prompt you to set a root password, remove anonymous users, disallow remote root login, remove the test database, and reload privilege tables.


Step 4: Install phpMyAdmin

Install phpMyAdmin along with necessary PHP extensions:

sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl

During installation:

  • When prompted to choose a web server, select apache2.
  • Choose Yes when asked to configure the database for phpMyAdmin with dbconfig-common.
  • Set a password for the phpMyAdmin application.

Enable the mbstring PHP extension and restart Apache:

sudo phpenmod mbstring
sudo systemctl restart apache2

You can now access phpMyAdmin at http://localhost/phpmyadmin.


Step 5: Configure Apache (Optional)

If you're using Apache and want to set up a virtual host for your Laravel application:

  1. Create a new configuration file:
   sudo nano /etc/apache2/sites-available/your_domain.conf
  1. Add the following configuration, replacing your_domain and the document root path as appropriate:
   <VirtualHost *:80>
       ServerName your_domain
       DocumentRoot /path/to/your/laravel/public

       <Directory /path/to/your/laravel/public>
           AllowOverride All
           Require all granted
       </Directory>

       ErrorLog ${APACHE_LOG_DIR}/error.log
       CustomLog ${APACHE_LOG_DIR}/access.log combined
   </VirtualHost>
  1. Enable the new site and the rewrite module:
   sudo a2ensite your_domain.conf
   sudo a2enmod rewrite
   sudo systemctl restart apache2

Step 6: Install Composer (PHP Dependency Manager)

Composer is essential for managing PHP dependencies:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
sudo mv composer.phar /usr/local/bin/composer
composer --version

Step 7: Add Composer to PATH (Optional)

If you're installing global Composer packages:

Add this line to your ~/.bashrc or ~/.zshrc file:

export PATH="$HOME/.config/composer/vendor/bin:$PATH"

Then reload your shell configuration:

source ~/.bashrc

Related Posts

More content you might like

Tutorial

How to Stop SSH From Timing Out

Host *
    ServerAliveInterval 60
    ServerAliveCountMax 3

This ensures your SSH client pings the server regularly.

Aug 21, 2025
Read More
Tutorial

How to Translate URLs in React (2025 Guide)

When building a multilingual React application, translating the visible content is just part of the job. To make your app SEO-friendly and user-centric, you also need to:

  • Translate URLs/slugs (e.g., /about-us/fr/a-propos)
  • Maintain SEO with hreflang for each language
  • Improve UX by aligning URLs with user language
  • Ensure route accessibility via browser language or manual switching

May 04, 2025
Read More
Tutorial

Globalization in React (2025 Trends & Best Practices)

In 2025, users expect more than just language translation — they want your app to feel native to their region, culture, and behavior.

By implementing full globalization in your React application, you gain:

May 04, 2025
Read More
Tutorial

Implementing Internationalization (i18n) in a Large React Application (2025 Guide)

  • Translate your app without performance loss
  • Format dates, numbers, currencies natively
  • Scale your translations across large React apps
  • Add RTL (right-to-left) support for Arabic or Hebrew
  • Integrate with translation platforms like Locize or Crowdin
  • Explore SSR-ready i18n setups (e.g., with Next.js)
  • Use useContext for localized theme changes (e.g., cultural preferences)

May 04, 2025
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Be the first to share your thoughts!