Install PHP Development Environment in Fedora 27 using Apache, MariaDB and PhpMyAdmin

This Tutorial is intended to demonstrate the step-by-step installation and configuration of a PHP development environment in Fedora 27 using Apache, MariaDB and PhpMyAdmin.

Make your WordPress site’s Load Blazing Fast Just by moving to Nestify. Migrate your WooCommerce Store or WordPress Website NOW.


For those who want to migrate to Linux or just change the distribution to Fedora and also set up a framework for PHP development, this article is to show how easy it is to do this task without too much headache. The structure to be mounted will be with Apache, PHP, MariaDB and PhpMyAdmin.

Before you begin the installation, make sure your distribution is up to date. For those who are not yet familiar with the distribution, simply access the terminal and log in as root. To do this, type:


Then enter your password and press Enter.

At this point you should already be logged in as root. To perform the update, run the following command:

# dnf update -y

So you will be updating without having to confirm the action. If you want to confirm, simply remove the “- y” from the command.

Now let’s go to the Apache installation (to learn more about Apache, visit the page). To do this, run the terminal:

# dnf install httpd -y

Wait for the installation process to finish and run the following command to start the program:

# systemctl start httpd.service

After running the command, there are two ways to know if everything is working properly. The first is to access the address:

→ https: // localhost



The “Fedora Test Page” should appear, as in the figure below.

The second way, is through the command:

# systemctl status httpd.service

If everything is working correctly, the response of the command should look like the figure below:

If you want to start Apache with the operating system, you can do so by running the command:

# systemctl enable httpd.service

At the moment, only local access is allowed by the system. If you want to release public access to the page, you must allow it through the Firewall.

To allow access to the page via HTTP, type:

# firewall-cmd –permanent –add-port = 80 / tcp

And for HTTPS access (HTTP with an extra security layer), type:

# firewall-cmd – permanent –add-port = 443 / tcp

After you type the commands, you must restart the Firewall for the changes to take effect. To do this, run:

# systemctl reload firewalld

Ready. Your Apache is already installed and configured to run your environment. Now we will install the MariaDB database manager system.


To do the MariaDB installation (learn more about MariaDB at, run the following command:

# dnf install mariadb-server -y

Then start MariaDB:

# systemctl start mariadb.service

If you want to enable it, start with the operating system, type:

# systemctl enable mariadb.service

By default, it is necessary to enable the MariaDB root password, to do this execute the following command:

# mysql_secure_installation

With this, there must be the following return (be aware of the settings after entering the new password):



In order to log into MariaDB to secure it, we’ll need the current

password for the root user. If you’ve just installed MariaDB, and

you have not set the root password yet, the password will be blank,

so you should just press enter here.

Enter password for root (enter for none): [ENTER]

OK, successfully used password, moving on …

Setting the root password ensures that nobody can log into the MariaDB

root user without the proper authorization.

Set root password? [Y / n] y

New password: [Enter root password]

Re-enter new password: [Repeat password]

Password updated successfully!

Reloading privilege tables ..

… Success!

By default, MariaDB installation has an anonymous user, allowing anyone

to log into MariaDB without having a user account created for

them. This is intended only for testing, and to make the installation

go a bit smoother. You should remove them before moving into a

production environment.

Remove anonymous users? [Y / n] and

… Success!

Normally, root should only be allowed to connect from ‘localhost’. This

ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y / n] and

… Success!

By default, MariaDB comes with a database named ‘test’ that anyone can

access. This is also intended for testing, and should be removed

before moving into a production environment.

Remove test database and access it? [Y / n] y

– Dropping test database …

… Success!

– Removing privileges on test database …

… Success!

Reloading the privilege tables will ensure that all changes made

will take effect immediately.

Reload privilege tables now? [Y / n] and

… Success!

Cleaning up …

All done! If you’ve completed all of the above steps, your MariaDB

installation should now be secure.

Thanks for using MariaDB!

Once the installation is complete, you can test by entering with the new registered password. To do this, type:

# mysql -u root -p

Then enter your password. If the password is correct, there will be a return like the one described below:

Welcome to the MariaDB monitor. Commands end with; or \ g.

Your MariaDB connection id is 19

Server version: 10.2.9-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\ h’ for help. Type ‘\ c’ to clear the current input statement.

MariaDB [(none)]>

To exit MariaDB type:

> quit

Done. Your MariaDB database manager system is already installed and configured.

Now we will proceed to the installation of PHP.


To perform the PHP installation with the necessary dependencies for the development environment and for better integration with the other tools, run the following command:

# dnf install php php-fpm php-pdo php-gd php-mysqlnd php-mbstring php- common php-mcrypt php-gettext php-curl php-cli -y

Finished the installation of PHP and its dependencies, it will already be enabled on your system. To test it, let’s create a file called “test.php” in the default Apache directory ( / var / www / html ). For the procedure, run:

# vim /var/www/html/test.php

Note: in this case I am using Vim as a text editor. You can use the editor of your choice for this procedure.

Created and opened the file, we will insert the following code:

<? php phpinfo (); ?>

If you do this, save and close the file, and then restart Apache:

# systemctl restart httpd.service

To test if it is working properly, open your browser and type:

→ https: //localhost/test.php


→ http : //

The result should look like the figure below:

If the test is Ok, by security measure, delete the created file (test.php) because it displays several important server information.

All right! Now let’s install PhpMyAdmin to make it easier to manage our database.


As simple as the others, installing PhpMyAdmin (learn more about PhpMyAdmin at can be done by running the following command:

# dnf install phpmyadmin -y

After installation, you need to edit the “phpMyAdmin.conf” file on directory /etc/httpd/conf.d to be able to access the resource correctly. To do this, with the editor of your preference (in this case I’ll use Vim), open the file with the command:

# vim /etc/httpd/conf.d/phpMyAdmin.conf

Wherever you are:


       Require ip

       Require ip :: 1

 </ RequireAny>

Change to:

      # Require ip
      # Require ip :: 1
        Require all granted
 </ RequireAny>

After finishing, restart apache again:

# systemctl restart httpd.service

Then the browser, go to the address:

→ https: // localhost / phpmyadmin



If everything is operating normally, the PhpMyAdmin login screen should appear as in the figure below:

You can change the language or you can directly log in as root in PhpMyAdmin. The password was the same one created in the MariaDB installation steps.

Ready. Now you have a great environment for development.

Found an error, was left with doubts or something did not work? Leave a comment. We will respond as soon as possible.

Leave a Reply