Closed 1w3j closed 7 years ago
I've read 404Ghost99 question and your reply is not useful for me. systemctl status mysql and apache2 are active and running. I forgot to mention, the xvwa database is not being created or reloaded (is it related to links issue?)
@iqbal98 please mention which line/code you found wrong for bad include. If the config.php settings are correctly set, it should work without causing any error. I have also listed a automatic script that might help you to resolve this issue, please see it here https://github.com/s4n7h0/Script-Bucket/blob/master/Bash/xvwa-setup.sh
Please also note that the script might take absolute path, the config.php should look as below:
<?php
$XVWA_WEBROOT = "";
$host = "localhost";
$dbname = 'xvwa';
$user = "root";
$pass = "";
$conn = mysql_connect($host,$user,$pass);
$conn = mysql_select_db($dbname);
$conn1 = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$conn1->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
?>
Let me know if you able to solve the issue.
@s4n7h0 I've tried using your script:
MySQL found with Version: 5.7.16-1ubuntu16.04 Version: 5.7.16-0ubuntu0.16.10.1 Version: 5.7.15-0ubuntu2
Apache found with Version: 2.4.18-2ubuntu4
Enter mysql username : myuser
Enter mysql password : mypassword
Enter the full web root path : /var/www/html
Folder /var/www/html/xvwa already exists. Do you want to clean and build a fresh latest copy ? (Y/N)Y (please note here, there is an error if I input 'y':line 90)
Cleaning up old copy
Cloning latest version of XVWA from GitHub
Cloning into '/var/www/html/xvwa'...
remote: Counting objects: 952, done.
remote: Total 952 (delta 0), reused 0 (delta 0), pack-reused 952
Receiving objects: 100% (952/952), 2.15 MiB | 596.00 KiB/s, done.
Resolving deltas: 100% (211/211), done.
Checking connectivity... done.
Setting XVWA configuration
Creating xvwa database
mysql: [Warning] Using a password on the command line interface can be insecure.
XVWA Setup Finished Successfully. Happy hacking and happy learning !
Then I check my mysql server
mysql -u myuser -p
Enter password:
mysql> use xvwa;
Database changed
mysql> show tables;
Empty set (0,00 sec)
Tables were not created. Same as if I go to http://localhost/xvwa/setup/ Database keeps empty. AND the index.php page is a blank page same as setup.
I've changed some code on the php files and I noticed some wrongs on 'include' relative paths. e.g on header.php:line 18 Before:
include(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'/xvwa/config.php');
After:
include(__DIR__.'/xvwa/config.php');
Please, try to fix 'them'. Or tell me if I did something wrong. PD: I'm not a php guy at all, but using 'DIR' is more cool than 'dirname('blablabla')'
@iqbal98 the database is created only after you setup in using the web interface http://localhost/xvwa/setup/ I agree with your suggestion on changing the DIR. I will make these changes soon.
I know, the thing is I get a blank page as 404Ghost99 question, and when I edit the php script (e.g. header.php on line 18) I can finally see the interface, then I can press the Submit/Reset button but nothing happens. I think the same error is on other php scripts and there it causes no database loading (also, the login button heads me to another blank page resulting on nothing). Do you have the same problems? PD: I manually ran every SQL stmnt for your application to solve the issue for me:)
@iqbal98 I usually change the config.php $XVWA_WEBROOT = "";
and use this as prefix for paths I include in other pages. That usually works for me. ;)
using $XVWA_WEBROOT = "";
clones the project on /
(root directory). Then I moved that directory to /var/www/html
and same linking errors happen.
@iqbal98 that's weird. I will run through some test cases over this weekend and fix this issue. I never had this issue with my instance. Also didn't received this issue from other users yet.
@iqbal98 dirname(FILE) and DIR should return the same value. I'm quite not sure to justify which one is better than the other. I did some tests locally and only noticed the auto setup script had webroot parameter wrongly set. I made those changes and everything works smooth with no errors if you are using auto setup script.
MySQL found with Version: 5.6.30-1 Version: 5.6.27-2
Apache found with Version: 2.4.25-1 Version: 2.4.18-1
MySQL is down. Starting MySQL Service
Apache is down. Starting Apache Service
Enter mysql username : root
Enter mysql password :
Enter the full web root path : /var/www/html
Cloning latest version of XVWA from GitHub
Cloning into '/var/www/html/xvwa'...
remote: Counting objects: 952, done.
remote: Total 952 (delta 0), reused 0 (delta 0), pack-reused 952
Receiving objects: 100% (952/952), 2.15 MiB | 202.00 KiB/s, done.
Resolving deltas: 100% (211/211), done.
Checking connectivity... done.
Setting XVWA configuration
Creating xvwa database
Enter password:
XVWA Setup Finished Successfully. Happy hacking and happy learning !
Ok. The database was generated now but I have still problems. The error is thrown on include(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'/xvwa/config.php');
"and" every config.php inclusion (that whole path returns something like /var/www/html/..//xvwa/xvwa/config.php
and thats why I changed it to: __DIR__.'/config.php'
returning the correct path /var/www/html/xvwa/config.php
but...).
I used "raveren/kint" debugger and $XVWA_ROOT
always ends being null same as $conn
and $conn1
except for they simply never appear on the debug. One question. Why do you use two connections? I'm not saying it is wrong, it's just because I'm getting errors on config.php
.
PD: Is this issue just for me, srsly? I ran the automate script and changed my php.ini as you indicated.
@iqbal98 some pages were using depreciated functions and I ported those codes to php version now. Please pull the latest commit and try it. Thanks for pointing it out. Please let me know if you find any further issues.
Many php files seems to be wrongly linked including the login.php . idk if this happens just in my case but I tried manually changing 'include' paths on files like e.g. header.php, setup/home.php. Since header.php has bad 'include' links, the rest of the document never loads completely, showing up an almost blank page. Obviously, correcting the bad links solved the part of the issue, but there are many of them that I think it's kind of annoying for the end user to manually find and edit wrong coding. My os: Ubuntu - yakkety