path to ghostscript and unoconv not working though they are there

path to ghostscript and unoconv not working though they are there

by Jerry Lau -
Number of replies: 7

So I had to reinstall libreoffice via rpm on our Moodle 3.2.x test platform and not it says that the ghostscript and unoconv path is not there though they are!

Php 7.1.8 ... redhat 7.5 enterprise 64-bit

My ghostscript path is: /bin/ghostscript and unoconv is in /usr/bin/unoconv. They are there but when I put them in the System Path, they said they not valid. Was working before and we have an upgrade next Monday ... sad

I followed this to the tee

https://docs.moodle.org/36/en/Universal_Office_Converter_(unoconv)#CentOS_.2F_RedHat

Only diff is that I downloaded and installed the libreoffice version (6.1.3.x)  through their site and not through redhat's package (which is quite old) at 5.2.

Here is my "/etc/systemd/system/unoconv.service"

[Unit]
Description=Unoconv listener for document conversions
Documentation=https://github.com/dagwieers/unoconv
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=simple
Environment="UNO_PATH=/opt/libreoffice6.1/program"
ExecStart=/usr/bin/unoconv --listener

[Install]
WantedBy=multi-user.target


see attached 2 images

unoconv 1 error image


unoconv 2 settings

What did I do wrong?


Thanks!
Average of ratings: -
In reply to Jerry Lau

Re: path to ghostscript and unoconv not working though they are there

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

I've had this before when PHP's open_basedir setting prevented access to the paths in question so check PHP Info and see what this is set to.

If that doesn't help you could enable debugging for the site and see if the web server is logging any errors which may indicate why these files can't be accessed.

I don't think SELinux would cause this issue but check if this is enforcing and if so check audit.log for any failures.

Average of ratings: Useful (1)
In reply to Jerry Lau

Re: path to ghostscript and unoconv not working though they are there

by Ken Task -
Picture of Particularly helpful Moodlers

Check to see if 'ghostscript' in /usr/bin/ isn't really a symlink to the 'real name/app' ... gs.

Use path to the 'real' gs ... where ever that is on your system.

[root@server ~]# cd /usr/bin/
[root@server bin]# ls -l ghostscript
lrwxrwxrwx. 1 root root 2 May 10 06:45 ghostscript -> gs

Above shows symlink.

'SoS', Ken

In reply to Ken Task

Re: path to ghostscript and unoconv not working though they are there

by Steve de Niese -

Posting this cause ran into this issue too.

You can add the path (e.g. usr/bin/gs) to your php settings under open_basedir.

You just need to add this folder to your entry to grant access to it: e.g. in Plesk the entry may become something like:

{WEBSPACEROOT}{/}{:}{TMP}{/}{:}/usr/bin/du{:}/usr/bin/gs

(Using {:} as the divider in Plesk)

Average of ratings: Useful (1)
In reply to Jerry Lau

Re: path to ghostscript and unoconv not working though they are there

by Charles Krengel eLearn Solutions -

With Cloud Linux be aware that disabled_functions in PHP is set to block exec which is needed for Ghostscript to run and Annotate PDF to work.

To address this issue go to server multiPHP manager and edit the PHP-FPM for that site.

Edit PHP INI Directives and remove exec from the Disabled functions

Hope this saves someone time!

Attachment CloudLinuxDisabledFunctions.png
Average of ratings: Useful (2)
In reply to Charles Krengel eLearn Solutions

Re: path to ghostscript and unoconv not working though they are there

by Fernando Araoz -
Para MOODLE 3,8 no resuelve el problema.
In reply to Fernando Araoz

Re: path to ghostscript and unoconv not working though they are there

by Juan Gomez -

If you are using a system like control panel or ISPConfig that manager that give  access to moodle path you need to put in the PHP open_basedir the path to this directory:

something like this:




Average of ratings: Useful (1)
In reply to Charles Krengel eLearn Solutions

Re: path to ghostscript and unoconv not working though they are there

by Luke Clark -

This was exactly what I needed to fix the ghostscript issue. Thank you!