Forum


Replies: 1   Views: 2341
Passthru : permission denied and solution
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 UFNAFAAM  · 16-08-2017 - 18:25

Hi,

on my server, the pdf conversion with libreoffice didn't work.

After inspection, the command

passthru($libreOfficePath . ' --invisible --convert-to ' . $extension . ' ' . $docSource . ' --outdir ' . $outdir . $outputDebug, $codeReturn);

returned an int(77) inside $codeReturn (ie. a "permission denied" unix code)

The command

passthru('whoami');

correctly displays 'apache'

Finally, I understood that on my server the user 'apache' has no home directory.

My solution to make the convertor work correctly was to add the shell variable before : 

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

Hope that this solution will help.