Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
281619b4
Commit
281619b4
authored
Nov 14, 2015
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow non-default port in MySQL connection
parent
1bd54a7c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
qa-config-example.php
qa-config-example.php
+3
-0
qa-base.php
qa-include/qa-base.php
+4
-0
qa-db.php
qa-include/qa-db.php
+4
-3
No files found.
qa-config-example.php
View file @
281619b4
...
...
@@ -29,6 +29,9 @@
For persistent connections, set the QA_PERSISTENT_CONN_DB at the bottom of this file; do NOT
prepend the hostname with 'p:'.
To use a non-default port, add the following line to the list of defines, with the appropriate port number:
define('QA_MYSQL_PORT', '3306');
*/
define
(
'QA_MYSQL_HOSTNAME'
,
'127.0.0.1'
);
...
...
qa-include/qa-base.php
View file @
281619b4
...
...
@@ -262,6 +262,10 @@
define
(
'QA_FINAL_EXTERNAL_USERS'
,
QA_EXTERNAL_USERS
);
}
if
(
defined
(
'QA_MYSQL_PORT'
))
{
define
(
'QA_FINAL_MYSQL_PORT'
,
QA_MYSQL_PORT
);
}
// Possible URL schemes for Q2A and the string used for url scheme testing
define
(
'QA_URL_FORMAT_INDEX'
,
0
);
// http://...../index.php/123/why-is-the-sky-blue
...
...
qa-include/qa-db.php
View file @
281619b4
...
...
@@ -60,10 +60,11 @@
return
;
// in mysqli we connect and select database in constructor
if
(
QA_PERSISTENT_CONN_DB
)
$db
=
new
mysqli
(
'p:'
.
QA_FINAL_MYSQL_HOSTNAME
,
QA_FINAL_MYSQL_USERNAME
,
QA_FINAL_MYSQL_PASSWORD
,
QA_FINAL_MYSQL_DATABASE
);
$host
=
QA_PERSISTENT_CONN_DB
?
'p:'
.
QA_FINAL_MYSQL_HOSTNAME
:
QA_FINAL_MYSQL_HOSTNAME
;
if
(
defined
(
'QA_FINAL_MYSQL_PORT'
))
$db
=
new
mysqli
(
$host
,
QA_FINAL_MYSQL_USERNAME
,
QA_FINAL_MYSQL_PASSWORD
,
QA_FINAL_MYSQL_DATABASE
,
QA_FINAL_MYSQL_PORT
);
else
$db
=
new
mysqli
(
QA_FINAL_MYSQL_HOSTNAME
,
QA_FINAL_MYSQL_USERNAME
,
QA_FINAL_MYSQL_PASSWORD
,
QA_FINAL_MYSQL_DATABASE
);
$db
=
new
mysqli
(
$host
,
QA_FINAL_MYSQL_USERNAME
,
QA_FINAL_MYSQL_PASSWORD
,
QA_FINAL_MYSQL_DATABASE
);
// must use procedural `mysqli_connect_error` here prior to 5.2.9
$conn_error
=
mysqli_connect_error
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment