Replies: 4   Views: 4039
Stubborn permissions errors? try this.
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 peterhartree  · 03-10-2012 - 16:52

Hi folks. Just a heads up - I was having trouble getting started with PHPdocX PRO on my MAMP PRO development environment. None of the demos worked, so I checked my logs and found the following:
[03-Oct-2012 15:34:39] PHP Warning: ZipArchive::open() []: Empty string as source in /Applications/[removed]/phpdocx_pro/classes/ on line 533
[03-Oct-2012 15:34:39] PHP Warning: ZipArchive::extractTo() [ziparchive.extractto]: Permission denied in /Applications/[removed]/phpdocx_pro/classes/ on line 1045
My first step was to check the write permissions on the folders the script was running in, and the folder to which the document was to be saved. But, these permissions were correct. Further investigation revealed that the problem was the lack of write permissions on my PHP TMP directory. Adding the correct permissions fixes the issue.

(To find your PHP temporary directory, create a <?php phpinfo(); ?> file and look for the TMPDIR value. Note that on the Mac, you'll need to open Macintosh HD with hidden folders visible to find the /var/ directory).

Posted by admin  · 11-04-2013 - 12:13


Thanks for sharing your solution. Another option to change temp dir is set it when you instanciante CreateDocx, this is the constructor:

public function __construct($baseTemplatePath = PHPDOCX_BASE_TEMPLATE, $tempDir = null)

The second param allows you to set a custom temp path.


Posted by AndyEn  · 02-08-2013 - 20:16

So I seem stuck at that same point.

I ran the check and it gave me all green. Now going for the examples (/examples/easy/Bookmarks.php), I got these error mesgs:

Warning: ZipArchive::open() []: Empty string as source in /..../PHPDOCx_Pro/classes/ on line 708

Parse error: syntax error, unexpected '<' in /..../PHPDOCx_Pro/lib/log4php/LoggerAutoloader.php on line 143

and concluded, it's about that temp-file thing.

Since working on a hosted service, I can't seem to access the standard php-temp-dir and want to use this second solution. Now, I extend the constructor as suggested by admin

that is, set an actual path,

    public function __construct($baseTemplatePath = PHPDOCX_BASE_TEMPLATE, $tempDir = "../Temp")

in, line 651, version  2013.02.28 .

The directory exists and even has 777 access (for testing) but still I get those very same errors. Also with the usual things that come up to me - full path name, another "/" at the end...

Any ideas?



Did I choose a wrong constructor to to the change?


Posted by jorgelj  · 05-08-2013 - 08:25


You can set a custom temp path in config/phpdocxconfig.ini file. You need to change this option:

temp_path = ""