LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-23-2015, 01:31 PM   #1
mtwilson
LQ Newbie
 
Registered: Dec 2015
Posts: 7

Rep: Reputation: Disabled
Apache2 wont read my php files


I have Kali Linux (Debian 2.0) running on a VMWare virtual machine on a mac running OS 10.10.5.

I have been trying to get the Damn Vulnerable Web Application (DVWA) running so I can practice some web app hacking on it. I installed Apache2 PHP MySQL etc with out flaw and I get the default Apache2 index.html when I go to localhost or 127.0.0.1 but if I direct to 127.0.0.1/index.php or 127.0.0.1/login.php i get a blank white page - nothing happens.

I am sure this is something simple. I have not touched anything out of the box so perhaps I need to do something in the apache2.conf file.

here is the install code I used--
Code:
apt-get -y install apache2 mysql-server php5 php5-mysql php5-gd
I also stopped and re-started the apache server.
I am using the var/www/html webroot which is listed in 000-default.conf file

The other posts I found along these lines were several years old and the suggestions no longer applicable.
 
Old 12-23-2015, 03:43 PM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
okay...
First off, Debian 2.0? Serious? This is like testing tires for speed that were made one hundred years ago...anyway...
What permission do your files have? Are they world readable? Is your folder world readable? Can you bring up a plain HTML page correctly? What does the logfile say? PHP writes its errors in the apache log file...
A blank page usually hints on a PHP error...
Can you bring up phpinfo.php at all?
Start with a simple HTML file, put it in the RIGHT folder (/var/www/html if I'm correct) and see if you can look at that...then work from there...
And now for the more crucial thing: welcome to this forum We look forward to reading from you some more
Melissa

Last edited by ButterflyMelissa; 12-23-2015 at 04:04 PM.
 
Old 12-23-2015, 04:05 PM   #3
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,504

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
Can you confirm that the two php files you refer to are in the /var/www/html directory you have set as Document Root?

Do you have an info.php file? What does it show? If you don't have it create it (code below) in the /var/www/html directory and access it from a brower.

Quote:
<?php phpinfo(); ?>
In addition to the above questions asked, what is the doc root set to in the php.ini file?
 
Old 12-23-2015, 04:49 PM   #4
mtwilson
LQ Newbie
 
Registered: Dec 2015
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Thor_2.0 View Post
okay...
First off, Debian 2.0? Serious? This is like testing tires for speed that were made one hundred years ago...anyway...
What permission do your files have? Are they world readable? Is your folder world readable? Can you bring up a plain HTML page correctly? What does the logfile say? PHP writes its errors in the apache log file...
A blank page usually hints on a PHP error...
Can you bring up phpinfo.php at all?
Start with a simple HTML file, put it in the RIGHT folder (/var/www/html if I'm correct) and see if you can look at that...then work from there...
And now for the more crucial thing: welcome to this forum We look forward to reading from you some more
Melissa
Yes, I know it is old, it is what Kali Linux comes in. It's a hacker distro. The permissions are fine and as I mentioned I can see the apache2 default page fine (index.html) I will look into the log files. I am a little new to this but I can find those and look for specific PHP errors, should have thought of that. Thanks for the welcome
 
Old 12-23-2015, 04:52 PM   #5
mtwilson
LQ Newbie
 
Registered: Dec 2015
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by yancek View Post
Can you confirm that the two php files you refer to are in the /var/www/html directory you have set as Document Root?

Do you have an info.php file? What does it show? If you don't have it create it (code below) in the /var/www/html directory and access it from a brower.



In addition to the above questions asked, what is the doc root set to in the php.ini file?
Yes, everything is in the web root, here is the ls

root@kaliMike:/var/www/html# ls
about.php config docs external hackable index.html instructions.php logout.php php.ini robots.txt setup.php
CHANGELOG.md COPYING.txt dvwa favicon.ico ids_log.php index.php login.php phpinfo.php README.md security.php vulnerabilities

As you can see no info.php file.

Last edited by mtwilson; 12-23-2015 at 04:54 PM.
 
Old 12-23-2015, 05:00 PM   #6
mtwilson
LQ Newbie
 
Registered: Dec 2015
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by yancek View Post
Can you confirm that the two php files you refer to are in the /var/www/html directory you have set as Document Root?

Do you have an info.php file? What does it show? If you don't have it create it (code below) in the /var/www/html directory and access it from a brower.



In addition to the above questions asked, what is the doc root set to in the php.ini file?
This is the entire php.ini


; This file attempts to overwrite the original php.ini file. Doesnt always work.

magic_quotes_gpc = Off
allow_url_fopen on
allow_url_include on

That's it
 
Old 12-23-2015, 05:32 PM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
the problem is really simple, i don't remember th exact specifics, but you have to make sure php is working and so on.
on a debian web server it would Just Work (tm).
you seem a linux newbie - you shouldn't try to set up a web server, of all things, on kali linux.
why don't you try a netinstall of debian stable and choose the "web server" option when prompted.
wiki.debian.org will answer all your questions.

don't use the "-y" option with apt-get. the prompts are there for a reason, better to look at them and understand what you are actually doing there and if it succeeded.

(ps: it's kali 2.0, not debian 2.0)
 
Old 12-23-2015, 05:41 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
2.0 is the current version of Kali which was released 11 August 2015 and is based on Debian Jessie. When the package is installed via apt-get everything should be configured...

You do have a phpinfo.php file, so what happens when you try http://localhost/phpinfo.php?

Check your /var/log/apache2/error.log for errors. It might provide a clue why the php pages are not being displayed.

How did you install dvwa?
http://www.geekyshows.com/2014/07/in...ali-linux.html
 
Old 12-23-2015, 05:45 PM   #9
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Wink More info

and...just a tip, the option:

Code:
ls -al
provides more info...

Quote:
[melissa@Avalon OnePagers]$ ls -al
total 32
drwxr-xr-x 3 melissa users 328 27.06.2015 19:39 ./
drwxr-xr-x 4 melissa users 104 27.06.2015 19:39 ../
drwxr-xr-x 2 melissa users 112 27.06.2015 19:39 media/
-rw-r--r-- 1 melissa users 202 18.12.2010 18:20 notfound.htm
-rw-r--r-- 1 melissa users 1460 14.02.2011 06:48 OPMM001b.htm
-rw-r--r-- 1 melissa users 1460 14.02.2011 06:47 OPMM001b.htm~
-rw-r--r-- 1 melissa users 1284 14.02.2011 06:37 OPMM001.htm
-rw-r--r-- 1 melissa users 1130 14.02.2011 06:35 OPMM001.htm~
-rw-r--r-- 1 melissa users 452 08.11.2010 09:11 sitestyle.css
-rw-r--r-- 1 melissa users 561 14.02.2011 06:41 template.htm
-rw-r--r-- 1 melissa users 371 14.02.2011 06:33 template.htm~
see the -rw-r--r-- at every line? Those are the permission flags...

Melissa
 
Old 12-23-2015, 06:53 PM   #10
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,504

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
If all you have in your php.ini files is what you posted above, that is definitely not right. I'd agree with the statement above about not using Kali. Try Debian or some other major distribution. Although it isn't difficult to install to a hard drive, it is meant to actually be used from a DVD or flash drive.
 
Old 12-24-2015, 01:24 PM   #11
mtwilson
LQ Newbie
 
Registered: Dec 2015
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
you seem a linux newbie - you shouldn't try to set up a web server, of all things, on kali linux.
why don't you try a netinstall of debian stable and choose the "web server" option when prompted.
wiki.debian.org will answer all your questions.

don't use the "-y" option with apt-get. the prompts are there for a reason, better to look at them and understand what you are actually doing there and if it succeeded.

(ps: it's kali 2.0, not debian 2.0)
I mentioned I was new at this, however I have set up a number of servers before (IIS and apache on Mac OS). The reason I am attempting this on Kali Linux is in order to set up an intentionally vulnerable web app so I can practice with Kali. I included the -y prompt while following some other install instructions. You make a valid point. I do appreciate the help and I would not be here if I was as experienced as you seem to be. Thank you.
 
Old 12-24-2015, 01:27 PM   #12
mtwilson
LQ Newbie
 
Registered: Dec 2015
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Thor_2.0 View Post
and...just a tip, the option:

Code:
ls -al
provides more info...



see the -rw-r--r-- at every line? Those are the permission flags...

Melissa
Thank Melissal, I was aware of this. I had checked the permissions myself. I should have included them in my post.
 
Old 12-24-2015, 02:02 PM   #13
mtwilson
LQ Newbie
 
Registered: Dec 2015
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
2.0 is the current version of Kali which was released 11 August 2015 and is based on Debian Jessie. When the package is installed via apt-get everything should be configured...

You do have a phpinfo.php file, so what happens when you try http://localhost/phpinfo.php?

Check your /var/log/apache2/error.log for errors. It might provide a clue why the php pages are not being displayed.

How did you install dvwa?
http://www.geekyshows.com/2014/07/in...ali-linux.html
Thanks for the clarification on Kali Linux. That makes sense of course.

When I attempt to to go to http://localhost/phpinfo.php? I get a message saying; Unable to connect

Iceweasel can't establish a connection to the server at 127.0.0.1.

That is new. The other .php files just come up blank.

I went through my log files and I noticed this;

[Mon Dec 21 07:35:12.412644 2015] [mpm_prefork:notice] [pid 98692] AH00163: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Mon Dec 21 07:35:12.412745 2015] [core:notice] [pid 98692] AH00094: Command line: '/usr/sbin/apache2'
[Mon Dec 21 19:29:57.763967 2015] [core:error] [pid 16261] (13)Permission denied: [client 127.0.0.1:55774] AH00035: access to /dvwa/setup.php denied (filesystem path '/var/www/html/dvwa/setup.php') because search permissions are missing on a component of the path
[Mon Dec 21 19:31:39.542788 2015] [:error] [pid 16262] [client 127.0.0.1:55777] PHP Warning: require_once(dvwa/includes/dvwaPage.inc.php): failed to open stream: Permission denied in /var/www/html/login.php on line 4
[Mon Dec 21 19:31:39.542882 2015] [:error] [pid 16262] [client 127.0.0.1:55777] PHP Fatal error: require_once(): Failed opening required 'dvwa/includes/dvwaPage.inc.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/login.php on line 4
[Mon Dec 21 19:32:04.891782 2015] [:error] [pid 16263] [client 127.0.0.1:55778] PHP Warning: require_once(dvwa/includes/dvwaPage.inc.php): failed to open stream: Permission denied in /var/www/html/index.php on line 4
[Mon Dec 21 19:32:04.891854 2015] [:error] [pid 16263] [client 127.0.0.1:55778] PHP Fatal error: require_once(): Failed opening required 'dvwa/includes/dvwaPage.inc.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/index.php on line 4

So I went to login.php line 4...

<?php

define( 'DVWA_WEB_PAGE_TO_ROOT', '' );
require_once DVWA_WEB_PAGE_TO_ROOT . 'dvwa/includes/dvwaPage.inc.php';

and dvwa.Page.inc.php...

<?php

if( !defined( 'DVWA_WEB_PAGE_TO_ROOT' ) ) {
define( 'DVWA System error- WEB_PAGE_TO_ROOT undefined' );
exit;
}

session_start(); // Creates a 'Full Path Disclosure' vuln.

// Include configs
require_once DVWA_WEB_PAGE_TO_ROOT . 'config/config.inc.php';
require_once( 'dvwaPhpIds.inc.php' );


So in conclusion, Apache2 is working fine, this is a DVWA problem and I will figure it out. Many thanks to all who so kindly held my hand through this.
 
Old 12-24-2015, 03:53 PM   #14
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Quote:
Thank Melissal, I was aware of this. I had checked the permissions myself. I should have included them in my post.
Just nudging you along
You'll get there, dont worry
Melissa
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Not able to run PHP files on my apache2 webserver kushalkoolwal Debian 7 10-01-2009 04:41 PM
Apache2 executes PHP files if specified, but not index.php will.fletcher Linux - Server 6 07-07-2009 09:27 PM
apache2 / php5 wont load .php dave`2005 Linux - Server 1 11-15-2007 06:19 PM
php5 apache2 mysql4 don't work, php does not seem to read php.ini atom Linux - Software 5 03-24-2005 11:05 AM
Apache2 CGI-Perl will not read files fefeh Linux - Software 0 06-30-2003 08:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration