Hi,<br />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:<br /><br />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<br /><br />the line of code which is raising this error:<br />$workbook = new Spreadsheet_Excel_Writer('test.xls');<br /><br />i need to know how to configure my include_paths so i can get around this open_basedir_restriction.<br /><br />any help is appreciated.<br />thanks!<!--content-->
Welcome to the forum, kapstan. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><br /><br />I have replaced your cpanel username mentioned in your post with * instead. Please do not post user sensitive information in the public. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
Seems to be a bug in the OLE package with the way it handles tempnam within open_basedir.<br /><br />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?<br /><br />I don't have an environment handy at the moment but you could try the following to see if it'll help or not:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$workbook = new Spreadsheet_Excel_Writer('test.xls');<br />$workbook->setTempDir('/home/yourcpanelaccount/tmp');<br />... rest of your code ...<!--c2--></div><!--ec2--><br /><br />and see if that works.<br /><br />I'll try testing some options out in a little bit if that doesn't work for you.<br /><br />Welcome to the forums, too. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
Welcome to the forums kapstan <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
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 <b>yourcpanelaccount</b> in the line with your actual cpanel account name.<!--content-->
Thank you so much guys! that seems to have solved my problem!<br />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.<br /><br />also, sorry about including the username in the cpanel path.. i hadn't realized i'd done that.<br /><br /><!--content-->
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:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->ini_set("include_path", get_include_path().":/home/yourcpanelaccount/php");<!--c2--></div><!--ec2--><!--content-->
Welcome to the forum, kapstan. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><br /><br />I have replaced your cpanel username mentioned in your post with * instead. Please do not post user sensitive information in the public. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
Seems to be a bug in the OLE package with the way it handles tempnam within open_basedir.<br /><br />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?<br /><br />I don't have an environment handy at the moment but you could try the following to see if it'll help or not:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$workbook = new Spreadsheet_Excel_Writer('test.xls');<br />$workbook->setTempDir('/home/yourcpanelaccount/tmp');<br />... rest of your code ...<!--c2--></div><!--ec2--><br /><br />and see if that works.<br /><br />I'll try testing some options out in a little bit if that doesn't work for you.<br /><br />Welcome to the forums, too. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
Welcome to the forums kapstan <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
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 <b>yourcpanelaccount</b> in the line with your actual cpanel account name.<!--content-->
Thank you so much guys! that seems to have solved my problem!<br />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.<br /><br />also, sorry about including the username in the cpanel path.. i hadn't realized i'd done that.<br /><br /><!--content-->
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:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->ini_set("include_path", get_include_path().":/home/yourcpanelaccount/php");<!--c2--></div><!--ec2--><!--content-->