Skip to content

Commit

Permalink
Merge pull request #373 from digininja/db-port
Browse files Browse the repository at this point in the history
Db port
  • Loading branch information
ethicalhack3r authored Jul 31, 2020
2 parents b8fcdaf + a334d72 commit 30741c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,16 @@ The database server is not running. In a Debian based distro this can be done wi
sudo service mysql start
```
### Errors "MySQL server has gone away" and "Packets out of order"
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.
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.
For more information, see:
<https://www.ryadel.com/en/fix-mysql-server-gone-away-packets-order-similar-mysql-related-errors/>
### SQL Injection won't work on PHP v5.2.6.

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...
Expand Down
3 changes: 1 addition & 2 deletions dvwa/includes/DBMS/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
define( 'DVWA_WEB_PAGE_TO_ROOT', '../../../' );
}

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


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

0 comments on commit 30741c8

Please sign in to comment.