Forum


Replies: 12   Views: 7719
Problems with permissions on setup
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by msaunders  · 12-12-2012 - 09:35

I have uploaded and set up the scripts outside the main Public_html folder, all seems fine except when i try the basic example

require_once(FULL_PATH.'/app/phpdocx/classes/CreateDocx.inc');

$docx = new CreateDocx();
$docx->addText('DOCX content');
$docx->addText('End DOCX content');
$docx->createDocx(FULL_PATH.'app/word_documents/example.docx');

The FULL_PATH is the real path to my base hosting dir.

I get the following error

Warning: ZipArchive::extractTo() [ziparchive.extractto]: SAFE MODE Restriction in effect. The script whose uid is 512 is not allowed to access app/temp owned by uid 99 in app/phpdocx/classes/CreateDocx.inc on line 1091
2012-12-12 09:21:30,761 FATAL - Error while extracting the Base Template: there may be problems writing in the default tmp folder


I have made an amendment to CreateDocx.inc to specify the exact temp location:
private function getTempDir() {
/*
Marc Comented to specify temp location
if ( !function_exists('sys_get_temp_dir')) {
function sys_get_temp_dir() {
if ($temp = getenv('TMP')) {
return $temp;
}
if ($temp = getenv('TEMP')) {
return $temp;
}
if ($temp = getenv('TMPDIR')) {
return $temp;
}
$temp = tempnam(__FILE__,'');
if (file_exists($temp)) {
unlink($temp);
return dirname($temp);
}
return null;
}
} else {
return sys_get_temp_dir();
}
*/
return 'app/temp';
}


I have even opened that folder to permissions 777, and to differant users including nobody(apache user)

Does anyone have any ideas?

Thanks

Marc