LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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

Reply
 
Search this Thread
Old 11-20-2009, 11:28 AM   #1
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,434
Blog Entries: 6

Rep: Reputation: 51
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 !!
 
Old 11-20-2009, 11:44 AM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by your_shadow03 View Post
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?
 
Old 11-20-2009, 11:44 AM   #3
EdHeron
LQ Newbie
 
Registered: Oct 2009
Location: Albuquerque, NM USA
Distribution: Gentoo, CentOS
Posts: 8

Rep: Reputation: 0
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.
 
Old 11-20-2009, 12:11 PM   #4
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,434
Blog Entries: 6

Original Poster
Rep: Reputation: 51
CentOS,
All I want is user "paul" to write to www directory under which index.php is present.
How can I make it possible?
 
Old 11-20-2009, 12:45 PM   #5
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by your_shadow03 View Post
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..
 
Old 11-22-2009, 02:35 AM   #6
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,434
Blog Entries: 6

Original Poster
Rep: Reputation: 51
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
???
 
Old 11-25-2009, 10:27 AM   #7
EdHeron
LQ Newbie
 
Registered: Oct 2009
Location: Albuquerque, NM USA
Distribution: Gentoo, CentOS
Posts: 8

Rep: Reputation: 0
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
 
  


Reply

Tags
usermod


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to start apache on CentOS Linux with error Starting httpd: Syntax error on lin pkumar2533 Linux - Newbie 9 08-26-2009 07:48 AM
Apache Error 403 - CentOS 5.2 with Apache 2.2.3 gordymann Linux - Newbie 2 04-08-2009 08:57 AM
apache 1.3.27, https url returns error -12263 in Firefox, fatal error (40) in Opera leo22838 Linux - Server 0 04-04-2008 01:51 PM
Apache 2.0.47 error wanna13e Linux - Server 2 06-24-2007 10:06 AM
Apache Error (Internal Server Error) dwarf007 Linux - Software 1 07-17-2005 01:16 PM


All times are GMT -5. The time now is 11:04 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration