We're here to assist with any of your needs, don't hestitate to reach out.
The LAMP stack is a popular open-source web development platform that includes Linux as the operating system, Apache as the web server, MySQL as the database management system, and PHP as the scripting language. This guide will walk you through the installation process on Ubuntu 18.04.
Before installing any software, it's important to update the package repositories on your Ubuntu system. Open a terminal and execute the following command:
sudo apt update
Apache is a widely-used web server that will host your website. To install Apache, run the following command:
sudo apt install apache2
Allow incoming traffic on port 80, which is the default HTTP port. Execute the command:
sudo ufw allow 'Apache'
MySQL is a popular database management system that will store your website's data. Install MySQL by running the following command:
sudo apt install mysql-server
During the installation, you will be prompted to set a password for the MySQL root user.
PHP is a powerful scripting language that is used to dynamically generate web pages. Install PHP and its required modules with the command:
sudo apt install php libapache2-mod-php php-mysql
To enable PHP processing with Apache, you need to modify the dir.conf
file. Open the file using the command:
sudo nano /etc/apache2/mods-enabled/dir.conf
Move the PHP index file index.php
to the first position so that it takes precedence over index.html
. The file should look like:
\
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
\
Save the file and exit the text editor.
After making any configuration changes, you need to restart Apache for the changes to take effect. Execute the following command:
sudo systemctl restart apache2
Create a PHP test file in the Apache root directory with the command:
sudo nano /var/www/html/info.php
Add the following PHP code to the file:
\
Save the file and close the text editor.
Now, you can test to see if PHP processing is working correctly by visiting http://your_server_ip/info.php
in a web browser. You should see a page displaying PHP configuration information.
That's it! You have successfully installed the LAMP stack on your Ubuntu 18.04 system. Now, you can begin developing and hosting your website using this powerful web development platform.
What our customers say about us
Create your free account today.