Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-20-2009, 12:28 PM
|
#1
|
Senior Member
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,466
Rep:
|
Apache Error?
I am getting this error whenever I access the page:
Code:
PHP Warning: fgets(): supplied argument is not a valid stream resource
Any idea whats all about?
I explored and found it permission issue.
I want to put a user call paul in apache group.Any idea how can I do that?
That could solve my issue..i think !!
|
|
|
11-20-2009, 12:44 PM
|
#2
|
Senior Member
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137
Rep: 
|
Quote:
Originally Posted by your_shadow03
I am getting this error whenever I access the page:
Code:
PHP Warning: fgets(): supplied argument is not a valid stream resource
Any idea whats all about?
I explored and found it permission issue.
I want to put a user call paul in apache group.Any idea how can I do that?
That could solve my issue..i think !!
|
Code:
useradd -G group-name username
but i doubt this is your problem as the php is going to run as the apache user right??
and anyone that accesses the page has the rights of the apache user??
what are the permissions for the file being called?
|
|
|
11-20-2009, 12:44 PM
|
#3
|
LQ Newbie
Registered: Oct 2009
Location: Albuquerque, NM USA
Distribution: Gentoo, CentOS
Posts: 8
Rep:
|
The error message by itself is not sufficient to guess it's cause. With code, you should write a small example script that replicates the issue and is postable.
As far as adding an existing user to an existing group, you'd use usermod. Check out the usermod manual page with man usermod. However, to add the user paul to the group apache, you should be able to use something like usermod --append --groups apache paul or, the short version might be usermod -aG apache paul
Before adding paul to the apache group, verify paul's current group membership with id --groups --name paul or id -Gn paul
After adding paul to the apache group, verify paul's new group membership.
Hope this solves your PHP issue, as well. Good luck.
|
|
|
11-20-2009, 01:11 PM
|
#4
|
Senior Member
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,466
Original Poster
Rep:
|
CentOS,
All I want is user "paul" to write to www directory under which index.php is present.
How can I make it possible?
|
|
|
11-20-2009, 01:45 PM
|
#5
|
Senior Member
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137
Rep: 
|
Quote:
Originally Posted by your_shadow03
CentOS,
All I want is user "paul" to write to www directory under which index.php is present.
How can I make it possible?
|
well as i said, assuming your apache user has write permissions, add paul to the apache group.
does user paul access this via a browser?? if so, i cant see how this makes a diff as the file is called as the apache user..
|
|
|
11-22-2009, 03:35 AM
|
#6
|
Senior Member
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,466
Original Poster
Rep:
|
I am Very Confused..and Let me explain.
I have few files under /var/www/html as:
Code:
ls -la | grep www
drwxrwxrwx 8 root root 4096 Nov 21 03:04 www
cd www
ls -la
total 64
drwxrwxrwx 8 root root 4096 Nov 21 03:04 .
drwxr-xr-x 25 root root 4096 Nov 21 11:07 ..
drwxrwxrwx 2 root root 4096 Jan 16 2008 cgi-bin
drwxrwxrwx 3 root root 4096 Nov 20 12:16 error
drwxrwxrwx 5 john john 4096 Nov 22 08:18 html
drwxrwxrwx 3 root root 4096 Nov 20 12:18 icons
drwxrwxrwx 14 root root 4096 Nov 20 12:18 manual
drwxrwxrwx 2 root root 4096 Nov 20 13:32 usage
cd html
ls -la
total 44
drwxrwxrwx 5 john john 4096 Nov 22 08:18 .
drwxrwxrwx 8 root root 4096 Nov 21 03:04 ..
drwxrwsr-x 2 john john 4096 Oct 30 16:50 bytype
drwxrwxr-x 2 john john 4096 Nov 22 08:08 imgs
-rw-r--r-- 1 john john 3771 Oct 30 16:50 index.html
drwxrwsr-x 2 john john 4096 Oct 30 16:50 js
-rw-rw-r-- 1 john john 9909 Nov 22 08:14 notice.php
Code:
id john
uid=501(john) gid=501(john) groups=501(john),48(apache)
Now Just want to know Does User "john" has write permission to DOCROOT
???
|
|
|
11-25-2009, 11:27 AM
|
#7
|
LQ Newbie
Registered: Oct 2009
Location: Albuquerque, NM USA
Distribution: Gentoo, CentOS
Posts: 8
Rep:
|
Especially when using a CMS, I set ownership of the html directory to the apache user using
Code:
chown -R apache:apache /var/www/html
Since usually your web server runs as user apache, this gives adequate privileges for running the scripts. I'm sure there's something wrong with that and, hopefully, someone else will add what...
But you don't need the world writeable flag on. To turn it off, use
Code:
chmod -R o-w /var/www/html
I think you can set the sticky bits on the html directory to get new files to get the same ownership by using
Code:
chmod ug+s /var/www/html
|
|
|
All times are GMT -5. The time now is 01:26 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|