Re: spreadsheet_excel_writer -- problem using fseek.
| From: | Andrés Felipe Hernández | Date: | Wed, 08 Oct 2003 21:51:31 +0000 |
| Subject: | Re: spreadsheet_excel_writer -- problem using fseek. | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8353@lists.php.net to get a copy of this message | ||
Hi Stefan, thanks for answering.
Finally i found the problem. The OLE package --which is required by
Spreadsheet_Excel_Writer-- uses tempnam() to create some temporary files.
From the PHP manual:
string tempnam ( string dir, string prefix)
Creates a file with a unique filename in the specified directory. If the
directory does not exist, tempnam() may generate a file in the system's
temporary directory, and return the name of that.
Since this function was called without using a directory path, php atempts
to create the file at the systems default temp directory. As I am in a
shared host, there was an error due to php's safemode. I hacked the code
and called tempname() using a directory created by my own... and it worked!
This was kind of difficult to find as I got the error after removing an '@'
before a function call to fopen.
I am pretty sure very few people will run through the same problem but I
wanted to post this behaivior in case someone cares.
Thanks,
Andrés.
----- Original Message -----
From: "Stefan Neufeind" <stefan@neufeind.net>
To: <pear-general@lists.php.net>
Cc: "Andrés Felipe Hernández" <andres@alleati.com>
Sent: Wednesday, October 08, 2003 1:56 PM
Subject: Re: [PEAR] spreadsheet_excel_writer -- problem using fseek.
> On 8 Oct 2003 at 13:45, Andrés Felipe Hernández wrote:
>
> > Hi, I am trying to use spread spreadsheet_excel_writer but i am
> > getting the following warning:
> >
> > Warning: fseek(): supplied argument is not a valid File-Handle
> > resource in home/virtual/site474/.../OLE/PPS.php on line 154
> >
> > The thing is the package is not installed by the hosting, so i
> > uploaded the source to the folder where the script is. It seems like
> > the package tries to write all the content of the excel file to a temp
> > file, and since this is a shared hosting, the actual path to the temp
> > file might be broken (i think this have to do with safemode).
> >
> > So, my question is, does anybody of you knows how could i change the
> > source so that i can point the temp file to a valid path?... It is
> > very unlikely that the hosting will install the packages for me.
> >
> > I am still taking a look at the source codes but any help would be
> > greatly appreciated.
>
> Or could it be that user-rights are a problem for you? Some "crazy"
> hosters give you ftpaccess under your username but they run Apache
> and all PHP-scripts as wwwrun, which only has read-permissions on
> your ftp-directory. But this is mainly a question of the wrong hoster
> :-))
>
> Stefan
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php