Forum


Replies: 4   Views: 4463
Why does phpdocx transformdocument to pdf sometimes sets different permission?
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 alerts@dalescott.com  · 23-06-2014 - 03:55

Hi Folks, Just bought Corporate and trying to roll out my first project. The project steps are the following: Load data array of 50 clients that need documents. For each of 10 different docx templates { 1) Create docx from template. 2) Transform docx to PDF. 3) Copy PDF to another folder. } I'm running into a frustrating problem on step 2 where transformDocument from docx to PDF will generate a PDF with permission of 600 (rw-------) instead of the normal 644 rw-r--r--. The end result is that an error is generated on the next step when trying to copy the file to another folder: "failed to open stream: Permission denied." The script runs fine for a dozen records or so and then generates a PDF that can't copied, stopping the process. If I re-run he same record, the problem persists. If I move to the next record, the scripts runs normally. This points to a problem with certain records, I can;t figure out why. Here is the log for the particular template that is generating the problem files. 2014-06-22T19:15:14-07:00 phpdocx_logger INFO Set language: en-US 2014-06-22T19:15:14-07:00 phpdocx_logger INFO Enable compatibility mode. 2014-06-22T19:15:14-07:00 phpdocx_logger INFO Importing styles from an external docx. 2014-06-22T19:15:14-07:00 phpdocx_logger INFO Set DOCX name to: DistrictDocsTemp/33-67223-Riverside-Community-College-3-Note-2014-15FY. 2014-06-22T19:15:14-07:00 phpdocx_logger INFO Set DOCX name to: DistrictDocsTemp/33-67223-Riverside-Community-College-3-Note-2014-15FY. 2014-06-22T19:15:14-07:00 phpdocx_logger INFO Remove existing template tags. 2014-06-22T19:15:14-07:00 phpdocx_logger INFO Add word/document.xml content to DOCX file. 2014-06-22T19:15:14-07:00 phpdocx_logger INFO Close ZIP file 2014-06-22T19:15:14-07:00 phpdocx_logger INFO Copy DOCX file using a new name.

Posted by admin  · 23-06-2014 - 10:33

Hello, The conversion plugin is a external command so it creates the files with the same permissions the umask is set. It's really strange that the method creates some files with the right permissions and other not. You can try setting a new umask value to check if the error still persists. Regards.

Posted by alerts@dalescott.com  · 23-06-2014 - 18:24

An update..... I was wrong about the intermittent permissions. It is consistently writing rw-------. where "admin" is the owner and as a result, php can not copy the file....which stops the entire process. I'm on Mac OS X. I don't believe that I am using the plugin. How is this resolved? I tried running chmod after the PDF transform, but once again, php won't cooperate. Thx Jonathan

Posted by admin  · 24-06-2014 - 07:06

Hello, You need to set a new umask to change the default rw access to files. You can get more info on: http://support.apple.com/kb/ht2202 Regards.

Posted by alerts@dalescott.com  · 25-06-2014 - 08:55

Thanks. I will look into the Umask. As a temp solution, I was able to figure out how to set the folder owner to be _www so that the copt operation could proceed. Jonathan