LAMP

LAMP
A ready-made set of frequently used software for web application hosting: Apache, MySQL, PHP.

LAMP (Linux, Apache, MySQL, PHP) is a popular software suite for hosting websites and PHP applications. The main LAMP stack benefits are simple configuration and low cost. All components are free and open source. In addition, the Apache web server is extremely flexible. That's why the LAMP stack is popular.

Beget VPS with pre-installed LAMP is a set of software from the distribution packages. It does not require a separate installation and configuration to work.

Installation package information 

LAMP is a Linux web development stack that will require self-administration and a willingness to do customization for your project. 

LAMP stack consists of the following components:

  • Ubuntu 24.04
  • MySQL 8.0.41
  • Apache 2.4.58
  • PHP 8.4 (mod_apache)

Apache is a web server capable of executing PHP code (using mod_php) as part of the HTTP request processing. Due to this, a single web server can process all of the incoming requests.

MySQL is a database management system. It is often used in popular CMS and frameworks based on PHP. The database is needed to store dynamic website data: page content, list of users, product catalog, and any other data.

Full list of installed PHP modules
  • php-cli – command line tools for executing PHP scripts
  • php-mysql – provides interaction with MySQL
  • php-opcache – extension, provides caching of opcode and speeds up applications
  • php-readline – extension, implements the interface to GNU readline

Installing and working with LAMP

Installation of the LAMP software suite from the Beget control panel is done in one click. No additional parameters are required to specify when creating a server.

Before installation, you can select the server configuration and configure the SSH connection method: add an SSH key and/or generate a password to connect via SSH. If you don't specify either method of authentication, the password will be generated automatically and sent to email.

After creating the server and completing the LAMP installation, make sure that the welcome page opens at http://ip_server:

LAMP apache

It will indicate that the installation was successful.

To connect to the deployed server, type the command in the terminal (bash / Putty) ssh root@ip_server. You can find the IP address of your server in the deployed server control panel.

Working with LAMP

To work with LAMP, you need to know the location of the main files and directories:

  • By default, one virtual host is created, which is available at http://ip_server.
  • The directory with files for the virtual host is located by default in /var/www/html. For the web server to be able to read the contents of the files, we recommend that the user www-data be set as the owner of the files.
  • The password for the user root to MySQL database management system is in the file /root/.my.cnf.

During the LAMP server management, you can change any settings of your web server or MySQL database by yourself if necessary. We wish you good luck with the LAMP server setup and using it!

FAQ

Where are the Apache and virtual host configurations?

All the configuration files for the Apache web server are under /etc/apache2

The default virtual host configuration file is in: /etc/apache2/sites-enabled/000-default.conf

After making the configuration changes, don't forget to restart the web server: systemctl restart apache2.service

Where are the PHP configuration files?

The PHP configuration files for mod_php are located in: /etc/php/8.1/apache2

After making changes to the mod_php configurations, remember to restart the web server: systemctl restart apache2.service

The PHP configuration files for the CLI are under /etc/php/8.1/cli

How can I create a separate MySQL user?
  • Connect to MySQL with sudo mysql -uroot
  • After that, create a new user with the following command:
    CREATE USER 'user-name'@'localhost' IDENTIFIED BY 'password'
  • Grant the new user all rights:
    GRANT ALL PRIVILEGES ON * . * TO 'user-name'@'localhost'
  • For the changes to take effect, run the command:
    FLUSH PRIVILEGES
How can I restart Apache / MySQL?

Use the following commands to restart services:

  • Apache2: systemctl restart apache2.service
  • MySQL: systemctl restart mysql.service
How can I add an extension for PHP?

Most extensions are already pre-packaged in the repository. To install and plug a new extension in, run the commands:

  • apt install php-gd (php-gd is an example, you should use the name of the desired package)
  • systemctl restart apache2.service
LAMP
LAMP
1 core / 1 GB / 10 GB / 250 Mb/sec
Free with every server:

Automatic backup
Round-the-clock monitoring
Postal system
DNS hosting
Private networks
The server will be created automatically immediately after registering an account

0,08 €

per day
Categories
For developers