Forum


Replies: 4   Views: 3194
Giving user www-data read and write permissions in the directory /var/www/.config
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 harman.devp  · 26-06-2017 - 07:59

Hi,

My client has purchased the advanced phpdocx package and I am facing some issues. I'm trying to convert my docx file (generated with phpdocx) to pdf format. Referring to the part of the docs pasted below,

1. can you please clarify whether I need to create a new .config directory in /var/www for the www-data user in order to successfully generate the pdf?

2. if i create a new .config directory in /var/www and make www-data the owner, do i need to copy the libreoffice folder into .config for everything to work as it should?

In order to fix this problem, I ended up changing TransformDocAdvLibreOffice.inc file but I dont want to change the core plugin files. Please suggest an alternative to this in TransformDocAdvLibreOffice.inc file :

passthru('export HOME=/tmp && '. $libreOfficePath . ' --invisible --convert-to ' . $extension . ' ' . $docSource . ' --outdir ' . $outdir . $outputDebug);

NOTE: I have added the part - 'export HOME=/tmp && ' 

To call LibreOffice, the server:

  • Needs to delete the possible blockage of SELinux or the blockage of the execution settings of external programs
  • Needs read and write permissions in the .config folder of the user's HOME directory

So, for example, if the user of the web server is www-data, and the HOME directory of this user is the default /var/www, then you must provide the user www-data with read and write permissions in the directory /var/www/.config.

Posted by admin  · 26-06-2017 - 08:14

Hello,

You don't need to change the core files. We recommend using putenv to set a custom HOME value dynamically if needed:

<?php
putenv("HOME=/var/www");

You don't need to copy LibreOffice to the folder .config.  LibreOffice uses this folder for temp files, so the user that calls LibreOffice (for example www-data is a common default user of apache) must have rw access to that folder.

Regards.

Posted by harman.devp  · 26-06-2017 - 08:58

Hi admin,

Thanks for the prompt response, that problem has been fixed with your suggestion.

Another thing that I want to clear is that I'm using phpdocx with Laravel 5.3; How can I publish the phpdocxconfig.ini file so that  it is avaliable for editing, rather than digging into the plugin files and editing it?

Posted by admin  · 26-06-2017 - 09:44

Hello,

The file phpdocxconfig.ini is in the config folder, and it's a text file. There's no option to publish it, but maybe you can use a web editor; but note that this file also has the license key that you shouldn't redistribute.

Regards.

Posted by harman.devp  · 26-06-2017 - 10:11

Ok thanks for the help!