Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2011
    Posts
    92
    Thanks
    26
    Thanked 0 Times in 0 Posts

    localhost permissions (chmod) problem after moving to a new computer

    Background: I just moved all my localhost xampp files over to a brand new formatted computer, and now its having permissions issues.

    So my code is faulting with this error:
    Warning: chmod() [function.chmod]: Operation not permitted in /Applications/XAMPP/xamppfiles/htdocs/mysite.php on line 109. Where line 109 of my code is: chmod(image.jpg, 0777);

    Here's what I tried:

    I went into terminal and typed:
    chmod -R 777 /applications/xampp

    And that appeared to work fine (all the folders within xampp had the read & write permissions)... but I think the problem may have to do something with "chown". Because on my original computer, when I go to "get info" on the xampp folder I see: Home (Me), staff, everyone

    But on the new computer I see: system, admin, everyone... So I am thinking that may be my issue? Is there something I have to change in my .ini files?

    Any ideas? It's driving me nuts!

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Use chown to set the owner to the user that Apache is running as.

  • Users who have thanked Inigoesdr for this post:

    Juniper747 (03-31-2012)

  • #3
    New Coder
    Join Date
    Apr 2011
    Posts
    92
    Thanks
    26
    Thanked 0 Times in 0 Posts
    how do I know what xampp is "running as"?

    and what exactly would I type in at terminal to change chown... I am new at using terminal! Thanks so much.

  • #4
    New Coder
    Join Date
    Nov 2011
    Posts
    88
    Thanks
    4
    Thanked 26 Times in 26 Posts
    I take it this is xampp for Linux (as chmod/chown would be nonsensical on windows)

    To find the user just issue, as root,
    Code:
    ps -aux | grep apache
    Left hand column is user, you may have a couple running as root, but the majority will usually be running as 'nobody' or 'www-data'.

    Code:
    chown www-data:www-data
    to change the user and group at the same time - you'll probably want to do the lot so:
    Code:
    chown -R www-data:www-data /path/to/directory/*
    Or safer to do the directory itself, then cd in and issue:
    Code:
    chown -R www-data:www-data *

  • #5
    New Coder
    Join Date
    Apr 2011
    Posts
    92
    Thanks
    26
    Thanked 0 Times in 0 Posts
    Thank you Leslie... it was a chown issue...

    I ended up using the following after opening terminal as root (which I believe is the same thing you were telling me to do Leslie):


    Permissions (to change ownership):

    sudo chown -R nobody:admin /Applications/XAMPP/xamppfiles/htdocs
    and then entered:
    sudo chown -R nobody:admin /Applications/XAMPP/xamppfiles/var

    Permissions (to change access level):

    sudo chmod -R 777 /Applications/XAMPP/xamppfiles/htdocs

    This ended up working.


  •  

    Tags for this Thread

    Posting Permissions

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