Results 1 to 7 of 7

Thread: 404 not found when trying to access http://localhost/info.php after setting up LAMP

  1. #1
    Join Date
    Jul 2012
    Beans
    13

    404 not found when trying to access http://localhost/info.php after setting up LAMP

    I have tried to install Apache, mySQL, and PHP on Ubuntu 14.04. I can access local host in my browser and I get the default Apache page, which say "It Works!", but when I try to go to http://localhost/info.php I get the 404 error:

    Not Found

    The requested URL /info.php was not found on this server.

    Apache/2.4.7 (Ubuntu) Server at localhost Port 80


    this is what's in my info.php file:

    PHP Code:
    <html><head><title>PHP Test</title></head><body><?php phpinfo(); ?></body></html>
    Any help would be appreciated.
    Last edited by thirdnipple; May 14th, 2014 at 05:34 PM.

  2. #2
    Join Date
    Apr 2007
    Location
    Prishtina, Kosovo
    Beans
    192
    Distro
    Kubuntu 18.04 Bionic Beaver

    Re: 404 not found when trying to access http://localhost/info.php after setting up LA

    Where did you put that file ? Did you change DocumentRoot ?

  3. #3
    Join Date
    Jul 2012
    Beans
    13

    Re: 404 not found when trying to access http://localhost/info.php after setting up LA

    The file is in /var/www/

    I have not changed DocumentRoot. How would I do that?

  4. #4
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    2,795
    Distro
    Ubuntu Development Release

    Re: 404 not found when trying to access http://localhost/info.php after setting up LA

    The default location for DocumentRoot is now /var/www/html
    You can change it in /etc/apache2/sites-available/000-default.conf
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  5. #5
    Join Date
    Mar 2014
    Beans
    50

    Re: 404 not found when trying to access http://localhost/info.php after setting up LA

    You embedded php code in an <html> file. Strip the <html> tags and just leave the phpinfo() enclosed in the php tags. Assuming that your path to the location of the file is correct, it should execute your php function. Keep the same file name, with ".php" ending.
    Last edited by newbie2244; May 14th, 2014 at 04:26 PM. Reason: typo

  6. #6
    Join Date
    Jul 2012
    Beans
    13

    Re: 404 not found when trying to access http://localhost/info.php after setting up LA

    You guys are awesome!

    I modified the file to remove the <html> tags and moved the file to the html folder rather than changing the DocumentRoot and the page came up properly. Thanks again for all of the help!!!

  7. #7
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    2,795
    Distro
    Ubuntu Development Release

    Re: 404 not found when trying to access http://localhost/info.php after setting up LA

    Quote Originally Posted by newbie2244 View Post
    You embedded php code in an <html> file. Strip the <html> tags and just leave the phpinfo() enclosed in the php tags. Assuming that your path to the location of the file is correct, it should execute your php function. Keep the same file name, with ".php" ending.
    Huh?? That works fine. Try it. Both ways work fine.

    @thirdnipple: Glad you got it working.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •