tags:

views:

100

answers:

2

Hi, I just installed apache server on my local machine. I executed the following command for that:

sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart

However, if I put my test.php file in /var/www and open it with my browser I see nothing (I supposed to see "Hello, world!").

If I put test.txt file in this directory with "Hello". I see "Hello" in my browser. My PHP file contains the following.

<?php
print "Hellow, World";
?>

If I open this file with browser I see nothing (no error messages). May be the reason is that before I force browser to open php files by /user/bin/php? How can I remove this setting?

+2  A: 

A few things to check.

  • Do you see the "It works!" file apache creates?
  • Were there any install errors with aptitute
  • Check if the module is loaded

    apache2 -t -D DUMP_MODULES

Ólafur Waage
I see "It works!". I did not notice any error during installation (however I could miss something). apache2 -t -D DUMP_MODULES gives "apache2: bad user name ${APACHE_RUN_USER}".
Verrtex
Check if the user priv. for apache are correctly set. Check the apache config file for the username.
Ólafur Waage
Where and how can I find this file? In /var/www there are not such files. In /use/sbin/ I also cannot find files containing "priv".
Verrtex
+3  A: 
  1. You call it test.php at one point, and test.txt at another. Is it definitely named test.php?
  2. What URL are you using to access the file? Are you using http://localhost/test.php, or file:///var/www/html/test.php?
  3. At one point you say you see nothing, and at another point you say you see "It works"? Which is it?
dj_segfault
I had 2 files: test.php and test.txt. I could see content of test.txt and could not see content generated by test.php. "It works" was generated by index.html. By the way, you solved the problem. I used /vat/www/test.php instead the http://localhost/test.php. The second works. Thank you!
Verrtex