Safe mode on does not allow copy of saved file

Topics: Developer Forum, Project Management Forum
Aug 12, 2010 at 1:30 PM



In linux, with the PHP safe mode on, the code $objWriter->save('php://output'); gives this error.

header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="sal_aslei.xlsx"');
header('Cache-Control: max-age=0');
include 'phpexcel/PHPExcel.php';
$objPHPExcel = new PHPExcel();
 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');



[error] [client] PHP Warning: copy() [<a href='function.copy'>function.copy</a>]: SAFE MODE Restriction in effect. The script whose uid/gid is 1000/1001 is not allowed to access ./phpxltmpiAFFbH owned by uid/gid 33/33 in /var/www/xxxxxx/phpexcel/PHPExcel/Writer/Excel2007.php on line 342, referer: https://xxxxxxx.php

I added the paths in the safe_mode_dir, includes... etc...and chmod but still does not work. Can you help me to solve this? I cannot turn SAFE MODE off in a production web server.

Can you help me?


Thank you


Aug 12, 2010 at 1:38 PM

i forgot to mention that the temporary file is successfully created. Only when the phpexcel tries to copy the tmp file to the final name, it does not work.