Apache and writing to NFS

This is a discussion on Apache and writing to NFS within the Apache forums in Application Servers & Tools category; Hello, I am trying a script (PHP) that writes files to disk. Now, writing the files locally works file, if I have a write-to directory owned apache:apache. Files created are owned apache:apache by default. But, I want to try this: I have an NFS share that has a large amount of space. I want the files to be written on there. So, I mount the NFS share as a directory and chown it apache:apache. Even chmodded it 777 just to be sure. It keeps failing when writing to it. I get the following error: failed to open stream: Stale NFS ...

Go Back   Application Development Forum > Application Servers & Tools > Apache

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 11-10-2008, 02:41 PM
Frank Kimbell
Guest
 
Default Apache and writing to NFS

Hello,

I am trying a script (PHP) that writes files to disk.
Now, writing the files locally works file, if I have a write-to
directory owned apache:apache.
Files created are owned apache:apache by default.

But, I want to try this:
I have an NFS share that has a large amount of space. I want the files
to be written on there. So, I mount the NFS share as a directory and
chown it apache:apache. Even chmodded it 777 just to be sure.

It keeps failing when writing to it.
I get the following error:

failed to open stream: Stale NFS file handle in script.php on line 6
(line 6 contains the php-fwrite command)

I don't think this is related to PHP, but to Apache that has
permission problems writing to an NFS share.

I am using Apache 2.2 and PHP5. SELinux is OFF.

Any idea?

TY

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Reply With Quote
  #2  
Old 11-10-2008, 05:14 PM
Justin Pasher
Guest
 
Default Re: Apache and writing to NFS

Frank Kimbell wrote:
> Hello,
>
> I am trying a script (PHP) that writes files to disk.
> Now, writing the files locally works file, if I have a write-to
> directory owned apache:apache.
> Files created are owned apache:apache by default.
>
> But, I want to try this:
> I have an NFS share that has a large amount of space. I want the files
> to be written on there. So, I mount the NFS share as a directory and
> chown it apache:apache. Even chmodded it 777 just to be sure.
>
> It keeps failing when writing to it.
> I get the following error:
>
> failed to open stream: Stale NFS file handle in script.php on line 6
> (line 6 contains the php-fwrite command)
>
> I don't think this is related to PHP, but to Apache that has
> permission problems writing to an NFS share.
>
> I am using Apache 2.2 and PHP5. SELinux is OFF.
>
> Any idea?
>


If you su to the apache user, can you create a new file in the same
directory? If not, then the permissions will need to be fixed so the
apache user has write access to that directory. If so, then apache
should have no problem writing to the directory from a script.
Considering the error message states "Stale NFS file handle", it sounds
like something might be wrong with the NFS mount or possibly the network
connection between the server machine and client machine. You can try
checking the system logs on both machines (/var/log/syslog) to see if
anything useful shows up in there. There might also be something in
/var/log/kern.log.

--
Justin Pasher

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Reply With Quote
  #3  
Old 11-11-2008, 03:13 AM
Frank Kimbell
Guest
 
Default Re: Apache and writing to NFS

Hi,

thanks for your reply.

I tried that, and get this:

[root@host web]# su apache
bash-3.00$ cd /website/nfs-directory
bash: cd: /website/nfs-directory: Stale NFS file handle

So also on the shell line, it gives this error...

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Reply With Quote
  #4  
Old 11-11-2008, 03:15 AM
Frank Kimbell
Guest
 
Default Re: Apache and writing to NFS

> I tried that, and get this:
>
> [root@host web]# su apache
> bash-3.00$ cd /website/nfs-directory
> bash: cd: /website/nfs-directory: Stale NFS file handle
>
> So also on the shell line, it gives this error...


What I forgot to mention is that, when I do this as root, I get no problems...
When I do this as apache,it gives that error

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Reply With Quote
  #5  
Old 11-11-2008, 03:27 AM
André Warnier
Guest
 
Default Re: Apache and writing to NFS

Frank Kimbell wrote:
>> I tried that, and get this:
>>
>> [root@host web]# su apache
>> bash-3.00$ cd /website/nfs-directory
>> bash: cd: /website/nfs-directory: Stale NFS file handle
>>
>> So also on the shell line, it gives this error...

>
> What I forgot to mention is that, when I do this as root, I get no problems...
> When I do this as apache,it gives that error
>

Anyway, what this tells you, is that it has nothing to do with Apache
per se. It is a problem of permissions, or NFS mounts, or something
like that.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 10:19 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.