Re: spreadsheets are opened read only
| From: | Ashley Sheridan | Date: | Wed, 24 Sep 2008 12:57:14 +0000 |
| Subject: | Re: spreadsheets are opened read only | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-280841@lists.php.net to get a copy of this message | ||
On Wed, 2008-09-24 at 15:43 +0300, Thodoris wrote:
> > Thodoris schreef:
> >>
> >>
> >>> On Wed, 2008-09-24 at 14:59 +0300, Thodoris wrote:
> >>>
> >>>>> On Wed, 2008-09-24 at 14:28 +0300, Thodoris wrote:
> >>>>>
> >>>>>> Hi guys. I am having a problem with opening xls files from a link
> >>>>>> generated from php script. Let me analyze this:
> >>>>>>
> >>>>>> I have two linux servers with apache (php,mysql etc) that are
> >>>>>> running the same project. There is a part in this project that
> >>>>>> reads all the files from a directory and generates the
> >>>>>> appropriate links to them. These files are usually spreadsheets
> >>>>>> (xls) and when I open a file using the link on the first machine
> >>>>>> it opens normally but when I open the file from the second it is
> >>>>>> opened read only.
> >>>>>>
> >>>>>> I have checked the rights and the ownership and they are the
> >>>>>> exact same from the servers document root to the file itself.
> >>>>>>
> >>>>>> Any ideas why is this happening?
> >>>>>>
> >>>>>> --
> >>>>>> Thodoris
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>> Do you have the spreadsheet opened on both machines at the same
> >>>>> time? If
> >>>>> so, then as far as I know there is no way to prevent it short of
> >>>>> versioning software. The first person opening a M$ Office document
> >>>>> marks
> >>>>> it as read-only for anyone else who later opens it at the same
> >>>>> time. As
> >>>>> soon as the first person closes it, it gets marked write-allowed.
> >>>>>
> >>>>>
> >>>>> Ash
> >>>>> www.ashleysheridan.co.uk
> >>>>>
> >>>>>
> >>>> No that is not the case since every server is completely independent
> >>>> from the other. That is why I was comparing the configuration and the
> >>>> rights. In addition to this I said that these are linux servers.
> >>>>
> >>>> The weird is that apache opens the files and sends them and openoffice
> >>>> takes the file and opens it. There is a difference in that procedure
> >>>> between the two that make the office to open the file as read only
> >>>> that I am not aware of.
> >>>> --
> >>>> Thodoris
> >>>>
> >>> I don't think you understood my response and I didn't really understand
> >>> yours. Are you saying that you have two configurations, with two
> >>> servers
> >>> and two workstations that should be acting the same and aren't?
> >>>
> >>>
> >>> Ash
> >>> www.ashleysheridan.co.uk
> >>>
> >>>
> >>
> >> Two servers (two configurations but similar) independent to each
> >> other running the same php scripts (everyone has its own copy).
> >>
> >> You click a link and browser asks you if you want to open or save the
> >> file. If you choose to open it then on the first server opens
> >> read-write but on the second writing is not permitted.
> >
> > Yeah, your opening them simultaneously on the same desktop, Excel sees
> > that they're
> > they have the same file name and makes the second read-only ... at
> > least that's
> > what i think Ash tried to explain. play with 'save as' using a
> > different file name
> > see if that clears up the situation
> >
> >
> >>
> >>
> >
>
> Sorry Ash I didn't got that on the first place but I use openoffice and
> when I open the same file the second time it opens it using a different
> name like test.xls-2 or something like that.
>
> But besides this when I upload a file (using a form) and then try to
> open it then it is opened it opens as read only on the first place.
>
> Is it possible that is this caused by apache or can I reconfigure
> php.ini to change this behavior?
>
> I suspect that the headers are being sent are somehow different .
>
If you are trying to open a file that has a URL instead of a local path,
then it will always be opened as read-only, and there is no way to
change this. If you are opening it using a local path (samba, nfs, fish,
etc) then I would check to see the file permissions. As the file is
being written by Apache from a form upload, the file will have Apache
permissions. Either exec out to a shell script and change the owner
(chown) of the file, or have Apache modify the persions with the
built-in PHP command chmod.
Ash
www.ashleysheridan.co.uk