PHP Classes

Not working properly. Safe mode problem?

Recommend this page to a friend!

      MS-Excel Stream Handler  >  All threads  >  Not working properly. Safe mode problem?  >  (Un) Subscribe thread alerts  
Subject:Not working properly. Safe mode problem?
Summary:Script doesn't run on my server.
Messages:3
Author:Ben Keen
Date:2005-01-19 08:15:50
Update:2005-01-27 14:24:18
 

  1. Not working properly. Safe mode problem?   Reply   Report abuse  
Picture of Ben Keen Ben Keen - 2005-01-19 08:15:50
When running this on my server, I get the following error message:

Warning: fopen(xlsfile://tmp/example.xls): failed to open stream: "xlsstream::stream_open" call failed in /home/squamish/public_html/admin/global/code/example_export.php on line 13
Cannot open xlsfile://tmp/example.xls

Is this anything to do with running in "safe_mode"? I did a little poking around and it looks like safe mode might get in the way of running fopen() properly.

Any suggestions?

  2. Re: Not working properly. Safe mode problem?   Reply   Report abuse  
Picture of Ignatius Teo Ignatius Teo - 2005-01-20 04:48:51 - In reply to message 1 from Ben Keen
See: http://www.php.net/manual/en/features.safe-mode.functions.php

If safe_mode is enabled, any call to fopen() "...checks whether the directory in which you are about to operate has the same UID (owner) as the script that is being executed".

If safe_mode is disabled, it could likely be that the directory specified in the fopen path doesn't exist, or PHP does not have the correct permissions to write to that directory.

  3. Re: Not working properly. Safe mode problem?   Reply   Report abuse  
Picture of Ben Keen Ben Keen - 2005-01-27 14:24:18 - In reply to message 2 from Ignatius Teo
Hi Ignatius,

Thanks for the help. It turns out that it *was* a safe mode problem. For those of you who find yourself in a similar boat, try the following:

upload a file called "php.ini" into the folder that you want the safe mode disabled. In it, just add this single line:

safe_mode = off

And that should do it! All the best - and thanks again, Ignatius - marvellous work!

Ben