Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-31-2012, 04:13 PM   PM User | #1
Juniper747
New Coder

 
Join Date: Apr 2011
Posts: 92
Thanks: 26
Thanked 0 Times in 0 Posts
Juniper747 is an unknown quantity at this point
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!
Juniper747 is offline   Reply With Quote
Old 03-31-2012, 04:24 PM   PM User | #2
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,604
Thanks: 2
Thanked 399 Times in 392 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Use chown to set the owner to the user that Apache is running as.
Inigoesdr is offline   Reply With Quote
Users who have thanked Inigoesdr for this post:
Juniper747 (03-31-2012)
Old 03-31-2012, 04:55 PM   PM User | #3
Juniper747
New Coder

 
Join Date: Apr 2011
Posts: 92
Thanks: 26
Thanked 0 Times in 0 Posts
Juniper747 is an unknown quantity at this point
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.
Juniper747 is offline   Reply With Quote
Old 04-01-2012, 08:29 PM   PM User | #4
leslie.jones
New Coder

 
Join Date: Nov 2011
Posts: 88
Thanks: 4
Thanked 26 Times in 26 Posts
leslie.jones is an unknown quantity at this point
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 *
leslie.jones is offline   Reply With Quote
Old 04-01-2012, 08:36 PM   PM User | #5
Juniper747
New Coder

 
Join Date: Apr 2011
Posts: 92
Thanks: 26
Thanked 0 Times in 0 Posts
Juniper747 is an unknown quantity at this point
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.
Juniper747 is offline   Reply With Quote
Reply

Bookmarks

Tags
chmod, chown, permissions, xampp

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:25 PM.


Advertisement
Log in to turn off these ads.