From 67b296d2b5b056fed254a2c8cb5813f89f4e0f59 Mon Sep 17 00:00:00 2001 From: Sneh Sagar Date: Thu, 5 Sep 2019 21:03:39 +0530 Subject: [PATCH] Port number added to database connection --- README.md | 2 +- public/installer/AdminConfig.php | 5 +++-- public/installer/EnvConfig.php | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 613b440cb..32e9da65b 100755 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ Although, mailer environment variables are also required to be set up as **Bagis ##### On server: -Warning: Before going full on production mode we recommend you to install developer dependencies. +Warning: Before going full on production mode we recommend you to uninstall developer dependencies. In order to do that, run the command below: > composer install --no-dev diff --git a/public/installer/AdminConfig.php b/public/installer/AdminConfig.php index cfb17829b..2172f3591 100755 --- a/public/installer/AdminConfig.php +++ b/public/installer/AdminConfig.php @@ -42,7 +42,7 @@ $data = array(); // reading env content $data = file($envFile); - $databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION']; + $databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION', 'DB_PORT']; $key = $value = []; if ($data) { @@ -67,10 +67,11 @@ $data = array(); $password = $databaseData['DB_PASSWORD']; $dbname = $databaseData['DB_DATABASE']; $connection = $databaseData['DB_CONNECTION']; + $port = $databaseData['DB_PORT']; if ($connection == 'mysql' ) { // Create connection - @$conn = new mysqli($servername, $username, $password, $dbname); + @$conn = new mysqli($servername, $username, $password, $dbname, (int)$port); // check connection if ($conn->connect_error) { diff --git a/public/installer/EnvConfig.php b/public/installer/EnvConfig.php index 27ffe01bb..f68ca88ab 100755 --- a/public/installer/EnvConfig.php +++ b/public/installer/EnvConfig.php @@ -117,8 +117,8 @@ $data = array(); // checking database connection(mysql only) if ($_POST["database_connection"] == 'mysql') { // Create connection - @$conn = new mysqli($_POST["host_name"], $_POST["user_name"], $_POST["user_password"], $_POST["database_name"]); - + @$conn = new mysqli($_POST["host_name"], $_POST["user_name"], $_POST["user_password"], $_POST["database_name"], $_POST['port_name']); + // check connection if ($conn->connect_error) { $errors['database_error'] = $conn->connect_error;