Install Apache, PHP and MySQL on Arch Linux

Author
By Darío Rivera
Posted On in Arch Linux

Arch Linux is an excellent operating system for developing web applications. If you are a developer or need to configure a project developed in PHP with Apache and MySQL, this article will guide you step by step to configure the necessary packages for this purpose.

Installation

The first step is to install the packages for the web server and the PHP language.

sudo pacman -S apache php php-apache

After this, you can configure the apache service to start every time the operating system starts with the following command.

systemctl enable httpd

If you want to start the service yourself on each occasion, you must start it as follows.

systemctl start httpd

Later, we can install the MySQL server with the following command.

sudo pacman -S mysql

After installation and before starting the service! you must run the following command.

sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Like the apache service, you can make MySQL start with the operating system

systemctl enable mysqld

If you want to start the service yourself on each occasion, you must start it as follows:

systemctl start mysqld

Once this is done, the next step will be to secure the installation. This means making some configurations such as creating passwords that are verified (length, special characters, uppercase and lowercase), removing anonymous users, disabling remote logging and removing test databases. For this you can use the following command and follow the instructions.

sudo mysql_secure_installation

And that's it, you can log in now. Don't forget to check out our post Terminal Connection to MySQL to see the different options for connecting.

Configuration

Once Apache, PHP, and MySQL are installed, it is convenient to make some configurations. To see a complete configuration of Apache from scratch, you can follow the following link.

Configure Apache from Scratch on Linux


Acerca de Darío Rivera

Author

Application Architect at Elentra Corp . Quality developer and passionate learner with 10+ years of experience in web technologies. Creator of EasyHttp , an standard way to consume HTTP Clients.

LinkedIn Twitter Instagram

Sólo aquellos que han alcanzado el éxito saben que siempre estuvo a un paso del momento en que pensaron renunciar.