Skip to content

Commit 30741c8

Browse files
Merge pull request #373 from digininja/db-port
Db port
2 parents b8fcdaf + a334d72 commit 30741c8

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,16 @@ The database server is not running. In a Debian based distro this can be done wi
275275
sudo service mysql start
276276
```
277277
278+
### Errors "MySQL server has gone away" and "Packets out of order"
279+
280+
There are a few reasons you could be getting these errors, but the most likely is the version of database server you are running is not compatible with the version of PHP.
281+
282+
This is most commonly found when you are running the latest version of MySQL as PHP and it do not get on well. Best advice, ditch MySQL and install MariaDB as this is not something we can support.
283+
284+
For more information, see:
285+
286+
<https://www.ryadel.com/en/fix-mysql-server-gone-away-packets-order-similar-mysql-related-errors/>
287+
278288
### SQL Injection won't work on PHP v5.2.6.
279289

280290
PHP 5.x reached end of life in January 2019 so we would recommend running DVWA with a current 7.x version, if you must use 5.x...

dvwa/includes/DBMS/MySQL.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
define( 'DVWA_WEB_PAGE_TO_ROOT', '../../../' );
1111
}
1212

13-
if( !@($GLOBALS["___mysqli_ston"] = mysqli_connect( $_DVWA[ 'db_server' ], $_DVWA[ 'db_user' ], $_DVWA[ 'db_password' ] )) ) {
13+
if( !@($GLOBALS["___mysqli_ston"] = mysqli_connect( $_DVWA[ 'db_server' ], $_DVWA[ 'db_user' ], $_DVWA[ 'db_password' ], "", $_DVWA[ 'db_port' ] )) ) {
1414
dvwaMessagePush( "Could not connect to the database service.<br />Please check the config file.<br />Database Error #" . mysqli_connect_errno() . ": " . mysqli_connect_error() . "." );
1515
if ($_DVWA[ 'db_user' ] == "root") {
1616
dvwaMessagePush( 'Your database user is root, if you are using MariaDB, this will not work, please read the README.md file.' );
1717
}
1818
dvwaPageReload();
1919
}
2020

21-
2221
// Create database
2322
$drop_db = "DROP DATABASE IF EXISTS {$_DVWA[ 'db_database' ]};";
2423
if( !@mysqli_query($GLOBALS["___mysqli_ston"], $drop_db ) ) {

0 commit comments

Comments
 (0)