Jump to content

Recommended Posts

Posted (edited)

Hi,

I need help configuring a PEAR package calledaSpreadsheet_Excel_Writer. I am receiving the following error when trying to instantiate a new Spreadsheet_Excel_Writer:

 

Warning: tempnam() [function.tempnam'>function.tempnam]: open_basedir restriction in effect. File() is not within the allowed path(s): (/home/***:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/***/php/OLE/PPS/File.php on line 87

 

the line of code which is raising this error:

$workbook = new Spreadsheet_Excel_Writer('test.xls');

 

i need to know how to configure my include_paths so i can get around this open_basedir_restriction.

 

any help is appreciated.

thanks!

Edited by TCH-Thomas
Removed cpanel username
Posted

Welcome to the forum, kapstan. :)

 

I have replaced your cpanel username mentioned in your post with * instead. Please do not post user sensitive information in the public. :lol:

Posted

Seems to be a bug in the OLE package with the way it handles tempnam within open_basedir.

 

Are you sure the line you have above there is the one that's causing the error and not the line that attempts to write to the file?

 

I don't have an environment handy at the moment but you could try the following to see if it'll help or not:

 

>$workbook = new Spreadsheet_Excel_Writer('test.xls');
$workbook->setTempDir('/home/yourcpanelaccount/tmp');
... rest of your code ...

 

and see if that works.

 

I'll try testing some options out in a little bit if that doesn't work for you.

 

Welcome to the forums, too. :)

Posted

Yea, I tried my above code and it seems to fix the problem so after you declare your workbook, set the TmpDir for it and you should be fine. Just make sure to replace yourcpanelaccount in the line with your actual cpanel account name.

Posted

Thank you so much guys! that seems to have solved my problem!

In the future, for additional PEAR packages installed through cpanel.. should i normally have to manually alter the paths to required .php files? i had to for this one before it would stop throwing errors about "file/stream not found" for some of the requires that the package was referencing.

 

also, sorry about including the username in the cpanel path.. i hadn't realized i'd done that.

Posted

Yea, your custom pear directory is not included, so you can do something like this in your PHP code to append it to the default include path:

 

>ini_set("include_path", get_include_path().":/home/yourcpanelaccount/php");

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...