Results 1 to 9 of 9

Thread: Ubuntu 14.04 - PHP Not Working

  1. #1
    Join Date
    Aug 2013
    Beans
    15

    Ubuntu 14.04 - PHP Not Working

    Hello,

    I recently installed a fresh version of Ubuntu 14.04 (desktop, but using it as server) and have tried to get LAMP working. I used the following guide:
    https://www.digitalocean.com/communi...tack-on-ubuntu

    However, when I try going to my php.info page (http://localhost/info.php), I get a 404. When I hit localhost directly, I get the correct apache test-page.

    Any ideas? TIA



    Thanks,
    Asif

  2. #2
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Ubuntu 14.04 - PHP Not Working

    Where did you put info.php ? It should go in /var/www/
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  3. #3
    Join Date
    Aug 2013
    Beans
    15

    Re: Ubuntu 14.04 - PHP Not Working

    Correct, that's what I did:

    aahmad@ubuntu-desktop:/var/www$ ll
    total 16
    drwxr-xr-x 3 root root 4096 Apr 27 11:10 ./
    drwxr-xr-x 14 root root 4096 Apr 27 00:37 ../
    drwxr-xr-x 2 root root 4096 Apr 27 00:37 html/
    -rwxrwxr-x 1 root root 20 Apr 27 11:10 info.php*

  4. #4
    Join Date
    Jun 2007
    Location
    Porirua, New Zealand
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Ubuntu 14.04 - PHP Not Working

    I read somewhere recently (citation needed) that the default location has moved in 14.04 from /var/www to /var/www/html.
    Forum DOs and DON'Ts
    Please use CODE tags - Including your email address in a post is not recommended
    Never assume that the information provided by Dr Google is up-to-date or relevant.

  5. #5
    Join Date
    Jun 2009
    Location
    0:0:0:0:0:0:0:1
    Beans
    4,716
    Distro
    Xubuntu

    Re: Ubuntu 14.04 - PHP Not Working

    one way to find out
    Code:
    cat /etc/apache2/sites-enabled/* | grep 'var/www'
    if it says /var/www/html lisati has your issue correct
    Laptop: ASUS A54C-NB91 (Storage: WD3200BEKT + MKNSSDCR60GB-DX); Desktop: Custom Build - Images included; rPi Server
    Putting your Networked Printer's scanner software to shame PHP Scanner Server
    I frequently edit my post when I have the last post

  6. #6
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    12,629
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Ubuntu 14.04 - PHP Not Working

    In 14.04, with Apache 2.4, the DocumentRoot has changed to /var/www/html. See /etc/apache2/sites-available/000-default.

    That is the same location that RedHat-flavored servers have used for years. I'm actually quite happy about this development, because I like to put other directories under /var/www that the webserver user ("www-data" on Ubuntu) can see, but that are outside the directories visible over the web.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  7. #7
    Join Date
    Aug 2013
    Beans
    15

    Re: Ubuntu 14.04 - PHP Not Working

    That was it! This was the output of the command:

    aahmad@ubuntu-desktop:~$ cat /etc/apache2/sites-enabled/* | grep 'var/www'
    DocumentRoot /var/www/html

    I moved the info.php file to the html directory, and the PHP Info page started working correctly.

    Thanks a bunch pqwoerituytrueiwoq and lisati, you guys rock! =)


    --Asif

  8. #8
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Ubuntu 14.04 - PHP Not Working

    Quote Originally Posted by SeijiSensei View Post
    In 14.04, with Apache 2.4, the DocumentRoot has changed to /var/www/html. See /etc/apache2/sites-available/000-default.

    That is the same location that RedHat-flavored servers have used for years. I'm actually quite happy about this development, because I like to put other directories under /var/www that the webserver user ("www-data" on Ubuntu) can see, but that are outside the directories visible over the web.
    Good to know. Thanks!
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  9. #9
    Join Date
    Aug 2013
    Beans
    15

    Re: Ubuntu 14.04 - PHP Not Working

    Thanks for the update SeijiSensei!

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
  •