Results 1 to 8 of 8

Thread: PHP & Permissions.

  1. #1
    Join Date
    Mar 2009
    Location
    Riga, Latvia
    Beans
    31
    Distro
    Xubuntu

    PHP & Permissions.

    I just installed PHP 5.

    I did like this...

    Code:
    sudo apt-get install apache2
    sudo apt-get install php5
    sudo /etc/init.d/apache2 restart
    Then I tried to save index.php (to test PHP) in /var/www/, but it said that I don't have permissions to do it.

    My friend helped me and here's solution:

    Code:
    sudo chown my_username:www-data /var/www -R
    Then I saved it in right folder, open 127.0.0.1 using web browser and PHP works! ...yeay!

    I created folder 'x' in /var/www/, tried to access it via web browser and... "Forbidden"!

    Any solutions?

  2. #2
    Join Date
    Mar 2009
    Location
    Riga, Latvia
    Beans
    31
    Distro
    Xubuntu

    Re: PHP & Permissions.

    Code:
    Server error.
    
    The website encountered an error while retrieving http://127.0.0.1/. It may be down for maintenance or configured incorrectly.

  3. #3
    Join Date
    Oct 2005
    Location
    Connecticut, USA
    Beans
    1,545
    Distro
    Ubuntu

    Re: PHP & Permissions.

    What are the permissions for the newly created folder ( #ls -l /var/www )?
    Friends don't let friends wear a red shirt on landing-party duty.
    DACS | Connecticut LoCo Team | My Blog
    Ubuntu User# : 17583, Linux User# : 477531

  4. #4
    Join Date
    Mar 2009
    Location
    Riga, Latvia
    Beans
    31
    Distro
    Xubuntu

    Re: PHP & Permissions.

    drwxr-xr-x for /www/.

  5. #5
    Join Date
    Oct 2005
    Location
    Connecticut, USA
    Beans
    1,545
    Distro
    Ubuntu

    Re: PHP & Permissions.

    Quote Originally Posted by daGrevis View Post
    drwxr-xr-x for /www/.
    And who is the owner/group?
    Friends don't let friends wear a red shirt on landing-party duty.
    DACS | Connecticut LoCo Team | My Blog
    Ubuntu User# : 17583, Linux User# : 477531

  6. #6
    Join Date
    Mar 2009
    Location
    Riga, Latvia
    Beans
    31
    Distro
    Xubuntu

    Re: PHP & Permissions.

    Code:
    dagrevis@dagrevis-desktop:~$ sudo ls -l /var/www
    [sudo] password for dagrevis: 
    total 4
    drwx------ 4 dagrevis dagrevis 4096 2010-12-29 07:48 uploader
    dagrevis@dagrevis-desktop:~$ sudo ls -l /var/www/uploader
    total 16
    -rwxr-xr-x 1 dagrevis dagrevis  941 2010-12-28 02:49 do__upload.php
    drwx------ 2 dagrevis dagrevis 4096 2010-12-29 07:48 includes
    -rwxr-xr-x 1 dagrevis dagrevis 1105 2010-12-28 02:51 index.php
    drwx------ 2 dagrevis dagrevis 4096 2010-12-28 02:55 uploads

  7. #7
    Join Date
    Mar 2009
    Location
    Riga, Latvia
    Beans
    31
    Distro
    Xubuntu

    Re: PHP & Permissions.

    Solution.

    Code:
    sudo chmod -R 555 /var/www/*

  8. #8
    Join Date
    Mar 2009
    Location
    Riga, Latvia
    Beans
    31
    Distro
    Xubuntu

    Re: PHP & Permissions.

    And this is improvement for solution. Do what I said and...

    Code:
    getent passwd
    
    sudo chown -R www-data /var/www
    sudo chmod -R 500 /var/www

Tags for this Thread

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
  •