0

I have installed PHP, MySQL, and Apache in my machine by following this tutorial. I created one file info.php to test if php is working on my apache server, but I go message file not found. Then, I tried to place info.php file inside html directory, it worked fine. Is it possible to change it to /var/www not in /var/www/html?

Please help. I am new to linux.

lyhong
  • 101
  • 1
  • 3
  • That usually happens on the later versions of Ubuntu (14.04). It's perfectly fine as long as your DocumentRoot points there. By the way, you can change it if you like – Zuko Sep 18 '14 at 07:47
  • check out the index.html page because it's not just an "it works!" page, it actually explains some of the differences. Also, take a look at the file /usr/share/doc/apache2/README.Debian.gz you will need to unzip it but it contains allot of info on how to do what you are talking about. Finally, run the command `man apache2` in an open terminal to read the manual pages. – mchid Sep 18 '14 at 08:25

1 Answers1

0

You can do something like this

 #open suphp.conf file 
 gksu "gedit /etc/suphp/suphp.conf
 #or like this
 sudo nano /etc/suphp/suphp.conf
 #change the document root folder 
 docroot=/var/www/  
 #to
 docroot=/home/user/public_html/
 #restart apache
 sudo service apache2 restart  
 #or like this
 sudo /etc/init.d/apache2 restart
 #test your new location
 echo "<?php echo 'whoim = '.exec('/usr/bin/whoami');?>" | tee /home/user/public_html/whomi.php

Now open your browser and navigate to localhost/whomi.php and you should see your ID. More detailed documentation can be found here

Zuko
  • 1,247
  • 11
  • 12