DVWA - Access Denied to for user 'dvwa'#'localhost' (using password: NO) - xampp

I am trying to install DVWA , I have copied the dvwa folder to htdocs of xampp. Changed the configuration as below . Still I am having the issue in connecting the database. When I try to access it via http://localhost/dvwa/login.php , I am receiving error as
Uncaught mysqli_sql_exception: Access denied for user 'dvwa'#'localhost' (using password: NO) in C:\xampp\htdocs\dvwa\dvwa\includes\dvwaPage.inc.php:498 Stack trace: #0 C:\xampp\htdocs\dvwa\dvwa\includes\dvwaPage.inc.php(498): mysqli_connect('127.0.0.1', 'dvwa', '', '', '3306') #1 C:\xampp\htdocs\dvwa\login.php(8): dvwaDatabaseConnect() #2 {main} thrown in C:\xampp\htdocs\dvwa\dvwa\includes\dvwaPage.inc.php on line 498
$_DVWA = array();
$_DVWA[ 'db_server' ] = '127.0.0.1';
$_DVWA[ 'db_database' ] = 'dvwa';
$_DVWA[ 'db_user' ] = 'dvwa';
$_DVWA[ 'db_password' ] = '';
$_DVWA[ 'db_port'] = '3306';

Related

Vimeo uploading Laravel giving -file_put_contents():Write of 207 bytes failed with errno=13 Permission denied

// controller
$file = $request->file('video');
$uri = Vimeo::upload($file, [
'name' => 'test',
'description' => 'easy upload'
]);
return $uri;
file_put_contents(): Write of 207 bytes failed with errno=13 Permission denied
The process running the app needs write permission to the temp directory (defaults to /tmp) for TusUpload to work.
For Laravel $request->file to work, the process also needs write permission to the file directory (this defaults to public/uploads in the root directory of the app, but can be configured)

symfony 4 app on heroku with remote database

I really need some help here hehe
Ok i got a symfony 4 application that is working perfectly in local environement.
I installed the app on heroku, but i want to access my Mysql database on my web hosting.
To be able to do that i had to install the Fixie app on heroku to have two ip adress and be able to whitelist those address for the remote access of my database.
The app is running good, but if i go to any links that have a call to do at the database i got a timeout.
I think the problem is in my index.php file, when installing Fixie you have to add code to the trust proxy
Heres what i have right now in my index.php file
<?php
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
$trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false;
$trustedProxies = $trustedProxies ? explode(',', $trustedProxies) : [];
if($_SERVER['APP_ENV'] == 'prod') $trustedProxies[] = $_SERVER['REMOTE_ADDR'];
if($trustedProxies) {
Request::setTrustedProxies($trustedProxies, Request::HEADER_X_FORWARDED_AWS_ELB);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
Thats the log message i get when i try to access a page that have a call to the database
2019-11-28T22:13:12.218311+00:00 app[web.1]: [2019-11-28 22:12:42] request.INFO: Matched route "publicResultat". {"route":"publicResultat","route_parameters":{"_route":"publicResultat","_controller":"App\\Controller\\PublicController::index"},"request_uri":"https://jugement.herokuapp.com/public","method":"GET"} []
2019-11-28T22:13:12.218435+00:00 app[web.1]: [2019-11-28 22:12:42] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
2019-11-28T22:13:12.220033+00:00 app[web.1]: [2019-11-28 22:13:12] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\ConnectionException: "An exception occurred in driver: SQLSTATE[HY000] [2002] Connection timed out" at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 93 {"exception":"[object] (Doctrine\\DBAL\\Exception\\ConnectionException(code: 0): An exception occurred in driver: SQLSTATE[HY000] [2002] Connection timed out at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:93, Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection timed out at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection timed out at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)"} []
When you install fixie in heroku you have to add something this is the example they give for php but i don't understand how to do that in my symfony app
PHP cURL is the easiest way to get your PHP application working correctly with Fixie. Here’s how:
<?php
function proxyRequest() {
$fixieUrl = getenv("FIXIE_URL");
$parsedFixieUrl = parse_url($fixieUrl);
$proxy = $parsedFixieUrl['host'].":".$parsedFixieUrl['port'];
$proxyAuth = $parsedFixieUrl['user'].":".$parsedFixieUrl['pass'];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_close($ch);
}
$response = proxyRequest();
print_r($response);
?>
Hope that i am clear on my problem
any help would be very useful
I also found strange that i have no header present when the call is done
Request URL: https://jugement.herokuapp.com/public
Referrer Policy: no-referrer-when-downgrade
Thats all i have in the header

AWS S3 error when trying to upload file in Laravel app

I'm trying to get S3 set up with my Laravel app (which is running on my local machine) but I'm getting the following error when trying to upload an image.
$my_file = 'file.txt';
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file);
$data = 'Test data to see if this works!';
fwrite($handle, $data);
$storagePath = Storage::disk('s3')->put("uploads", $my_file, 'public');
This is the error I'm getting:
Error executing "PutObject" on "https://landlord-files.s3.eu-west-2.amazonaws.com/uploads"; AWS HTTP error: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Installing Drupal on AWS EC2 with Acquia DB: SQLSTATE[HY000] [2002] Connection refused

I have a Drupal 8 site built on my local machine with Acquia Dev Desktop. I am installing Drupal on AWS EC2, and am running into the following error.
Failed to connect to your database server. The server reports the
following message: SQLSTATE[HY000] [2002] Connection refused.
I have checked the db name, username, password, and port with my config.inc file, and still can't get it to connect. Here is a screenshot of the drupal install page with the error:
and this is my config.inc file info (with dummy password, but the real version does match what I am inputting in Drupal install page)
/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '33067';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';
/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'mypasswordhere';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['AllowUserDropDatabase'] = true;
Take a look on this answer. Because if you're using RHEL/CentOS machine could be solution.
Edit: RHEL/CentOS or any other EC2 system with SELinux enabled.

mysql query working in xamp but not in server

I installed master login system in php, it works perfect in XAMMP but in server it gives error in register page:
"There was an error ! Please try again !"
if(($db->query("INSERT INTO `".MLS_PREFIX."users` SET ?u", $user_data)) && ($id = $db->insertId()) && ($db->query("INSERT INTO `".MLS_PREFIX."privacy` SET `userid` = ?i", $id)) && ($db->query("INSERT INTO `".MLS_PREFIX."privacy1` SET `chart` = '1', `vip` = '1', `userid` = ?i", $id))) {
$page->success = 1;
$_SESSION['user'] = $id;
$user = new User($db);
} else
$page->error = "There was an error ! Please try again !";
Don not include the dot in the backtics; the correct syntax is:
`dbname`.`tablename`

Resources