phpMyAdmin - Environment Setup



As phpMyAdmin is PHP based, following four vital components need to be installed on your computer system before installing phpMyAdmin.

  • Web Server − PHP works with virtually all Web Server software, including Microsoft's Internet Information Server (IIS) but most often used is Apache Server. Download Apache for free here − https://httpd.apache.org/download.cgi. Apache 2.4 is used in this tutorial.

  • Database − phpMyAdmin manages MySQL or MariaDB databases. In this tutorial, we can using MySQL database. Download MySQL for free here − https://www.mysql.com/downloads/. MySQL 8.0 is used in this tutorial.

  • PHP Parser − In order to process PHP script instructions, a parser must be installed to generate HTML output that can be sent to the Web Browser. This tutorial will guide you how to install PHP parser on your computer. Php 7.4 is used in this tutorial.

  • Web Browser − phpMyAdmin is a web based software, so web browser is needed with javascript and cookies enabled. We are using Google Chrome in this tutorial.

PHP Parser Installation

Before you proceed, it is important to make sure that you have proper environment setup on your machine to develop your web programs using PHP. Store the following php file in Apache's htdocs folder.

phpinfo.php

Example

<?php
   phpinfo();
?>

Output

Type the following address into your browser's address box.

http://127.0.0.1/phpinfo.php

If this displays a page showing your PHP installation related information, then it means you have PHP and Webserver installed properly. Otherwise, you have to follow the given procedure to install PHP on your computer.

This section will guide you to install and configure PHP over the following four platforms −

Apache Configuration

If you are using Apache as a Web Server, then this section will guide you to edit Apache Configuration Files.

Check here − PHP Configuration in Apache Server

PHP.INI File Configuration

The PHP configuration file, php.ini, is the final and immediate way to affect PHP's functionality.

Check here − PHP.INI File Configuration

Windows IIS Configuration

To configure IIS on your Windows machine, you can refer your IIS Reference Manual shipped along with IIS.

Install MySQL Database

The most important thing you will need, of course is an actual running database with a table that you can query and modify.

  • MySQL DB − MySQL is an open source database. You can download it from MySQL Official Site. We recommend downloading the full Windows installation.

In addition, download and install MySQL Administrator as well as MySQL Query Browser. These are GUI based tools that will make your development much easier.

Finally, download and unzip MySQL Connector/J (the MySQL JDBC driver) in a convenient directory. For the purpose of this tutorial we will assume that you have installed the driver at C:\Program Files\MySQL\mysql-connector-java-5.1.8.

Accordingly, set CLASSPATH variable to C:\Program Files\MySQL\mysql-connector-java-5.1.8\mysql-connector-java-5.1.8-bin.jar. Your driver version may vary based on your installation.

Set Database Credential

When we install MySQL database, its administrator ID is set to root and it gives provision to set a password of your choice.

Using root ID and password you can either create another user ID and password, or you can use root ID and password for your JDBC application.

There are various database operations like database creation and deletion, which would need administrator ID and password.

We would use MySQL Database with root as ID and root@123 as password.

If you do not have sufficient privilege to create new users, then you can ask your Database Administrator (DBA) to create a user ID and password for you.

For a complete understanding on MySQL database, study the MySQL Tutorial.

phpMyAdmin installation

Download and unzip phpMyAdmin-5.1.1-all-languages.zip phpMyAdmin web application in a convenient directory. Then copy the folder to htdocs directory of Apache Web Server. We've renamed the phpMyAdmin-5.1.1-all-languages to phpMyAdmin and placed it inside the htdocs directory.

Before restarting Apache Server, we need to make changes to Apache Configuration and PHP Configuration to allow phpMyAdmin to work with MySQL and OpenSSL. Please do the following changes.

Apache Configuration Update

Locate /conf/httpd.conf file in Apache Web Server directory and update DirectoryIndex > index.html to index.php.

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
   DirectoryIndex index.php
</IfModule>

PHP Configuration Updates

Locate php.ini in PHP Installation directory and uncomment extensions for mysqli and openssl.

extension=mysqli
extension=openssl

Now enable the extension_dir to load extensions for mysqli and openssl.

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
;extension_dir = "./"
; On windows:
extension_dir = "ext"

That's it, now start the Apache Server and open localhost/phpmyadmin phpmyadmin in web browser to open the phpMyAdmin interface.

Advertisements