0

I have a been using a library called Unoconv. (Please note that in my local ubuntu [virtualbox-homestead], it's working as expected, but not in AWS.)

$unoconv = Unoconv::create([
    'unoconv.binaries' => '/usr/bin/unoconv',
]);

This is what I call in php. And I can confirm that /usr/bin/unoconv exists.

The initial error was:

exception: "Unoconv\Exception\RuntimeException" file : "/usr/bin/unoconv"


First, I though it was permission issue. So I adapted accordingly:

My Homestead permissions: -rwxr-xr-x 1 root root 63243 Aug 18 2015 unoconv

My AWS permissions: -rwxr-xr-x 1 root root 63243 Aug 18 2015 unoconv

Then I changed my AWS group to:

-rwxr-xr-x 1 www-data www-data 63243 Aug 18 2015 /usr/bin/unoconv


Then I tried editing /etc/nginx/fastcgi_params and added this line:

// This existed, so I didn't touch it
fastcgi_param REDIRECT_STATUS 200;

// I added this line
fastcgi_param PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/node/bin

And my nginx looks like this:

    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
    }

The error has now changed to:

exception: "Unoconv\Exception\RuntimeException" file: "/var/www/my_proj/vendor/php-unoconv/php-unoconv/src/Unoconv/Unoconv.php" line: 68 message:"Unoconv failed to transcode file"

The file path is changed.


Finally, I tried removing fastcgi_param REDIRECT_STATUS 200;, but nginx doesn't compile/throws a syntax error.

I am stuck on how to overcome the issue.


Update:

In /etc/init.d/php7.0-fpm, I can see PATH=/sbin:/usr/sbin:/bin:/usr/bin, but I am not sure how to fix this issue. Should I use /bin instead of /usr/bin? If I do, I get an error "Executable not found, proposed : /bin/unoconv"

Or is it permission issue?

senty
  • 12,385
  • 28
  • 130
  • 260

1 Answers1

0

try making the binary executable by using sudo chmod +x /path/to/unoconv

also , 'which unoconv' command will help you to find out the exact path of unoconv bin library.

also here is the link reference for your similar issue post: https://github.com/alchemy-fr/PHP-Unoconv/issues/5

  • The issue was apparently was giving `/var/www/`a `www-data` group so that it can create the necessary documents. Because OpenLibrary was trying to create some temp files there. Thanks for the input – senty Jan 23 '18 at 14:53