Ubuntu Server18 How To Enable Nginx Pdo Mysql

Ubuntu Server18: How to Enable Nginx Pdo Mysql

As a developer, you may have heard of Nginx, PDO, and MySQL – all are essential components of web applications. Nginx is a popular web server used to serve web content, while PDO is a PHP extension used to connect to different databases, including MySQL. In this article, we will guide you through the process of enabling Nginx Pdo Mysql on Ubuntu Server 18.

Prerequisites for installing Nginx Pdo Mysql

Before we start, you will need to have access to an Ubuntu Server 18 terminal. Nginx, PHP, and MySQL should already be installed on your server. If they aren’t, you can install them using the following command:

“`sudo apt update && sudo apt install nginx php php-fpm mysql-server“`

Enabling PDO on Ubuntu Server 18

PDO, or PHP Data Objects, is a PHP extension that allows for setting up a database connection to a variety of database systems. Here’s how to enable PDO on Ubuntu Server 18:

Step 1: Open your terminal, then type the following command:

“`sudo apt-get install php7.2-dev php7.2-mysql php7.2-gd php7.2-curl“`

Step 2: Once the download is complete, open the php.ini file using a text editor. You can use either nano or vim.

“`sudo nano /etc/php/7.2/cli/php.ini“`

Step 3: Scroll down to find the line that reads:


This line should be uncommented. To uncomment this line, remove the semicolon (;) from the beginning of the line. The resulting line should look like this:


Step 4: Save the changes and exit.

Step 5: Restart the PHP and Nginx services to apply the changes.

“`sudo systemctl restart php7.2-fpm“`

“`sudo systemctl restart nginx.service“`

Enabling Nginx on Ubuntu Server 18

Nginx is a lightweight and high-performance web server used widely for serving web pages. Here’s how to enable Nginx on Ubuntu Server 18:

Step 1: Install Nginx.

“`sudo apt-get update && sudo apt-get install nginx“`

Step 2: Once the installation is complete, start and enable the Nginx service.

“`sudo systemctl start nginx“`

“`sudo systemctl enable nginx“`

Enabling MySQL on Ubuntu Server 18

MySQL is a database server that allows developers to store and manage data. Enabling MySQL on Ubuntu Server 18 can be done easily with the following steps:

Step 1: Install MySQL.

“`sudo apt-get install mysql-server“`

Step 2: Once the installation is complete, start and enable the MySQL service.

“`sudo systemctl start mysql“`

“`sudo systemctl enable mysql“`


Having Nginx, PDO, and MySQL enabled is crucial when it comes to developing web applications. In this article, we’ve explained how to enable Nginx, PDO, and MySQL on Ubuntu Server 18. We hope this guide has been helpful in setting up your web development environment.

Leave a Reply

Your email address will not be published. Required fields are marked *