MaestroError / php-heic-to-jpg

The easiest way to convert HEIC images to JPEG with PHP and Laravel framework
MIT License
143 stars 20 forks source link

Permission denied (absent execute-permission) #28

Open lon9man opened 1 year ago

lon9man commented 1 year ago

Hello, noticed interesting case.

WHAT I DID

i installed your package in 2 places:

  1. local development (docker) - Debian GNU/Linux 11 (bullseye) 5.4.0-137-generic
  2. dev-server Ubuntu 22.04.3 LTS 5.15.0-1031-aws

WHAT I GOT

i got different execute-permissions in these 2 cases.

  1. local development (docker) image

  2. dev-server image

in case 1 package works as expected. in case 2 package works with error:

Couldn't convert HEIC to JPG: 'sh: 1: /home/user/app/vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-linux-arm64: Permission denied' | 
Bin used: 'php-heic-to-jpg-linux-arm64' HEIC: '/tmp/image-editor/image-editor-2iIvs9' 
Full Command: '/home/user/app/vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-linux-arm64 "/tmp/image-editor/image-editor-2iIvs9" "/tmp/image-editor/image-editor-2iIvs9-19333623666504703814bc31.41181168" 2>&1' 
Output from heif-converter-image exe: 

when i add execute-permission for php-heic-to-jpg-linux-arm64 then package works as expected.

QUESTIONS

  1. why permissions are different on 2 environments?
  2. how should look correct execute-permissons for files?
  3. why in case 1 execute-permissions are absent for files php-heic-to-jpg-{os-architecture}, but package works as expected? and in case 2 - not?
  4. what is the suggestion to make it work in both cases (add execute-permissons for all needed files or something else)?

thanks!

MaestroError commented 1 year ago

Hi, @lon9man! Thanks for reaching out! I am not sure why are they different but in the first case (local development (docker)) it used heicToJpg and execute permission was correct, so it worked 👍 In the second case, it tried to use php-heic-to-jpg-linux-arm64 probably because the "dev-server" is arm64 architecture. But execution permission wasn't set, so it threw an error.

Both cases acted logically, we just need to find out, why execution permission isn't set correctly for needed bin files (Second case) and yes, to make it work all needed files should have execute-permissions 👍

lon9man commented 1 year ago

@MaestroError, thanks for the response! Will you have a chance to detect the issue and update the package?

Offtop question: Method convertFromUrl creates temporary file inside project-root.. as for me it should create it inside /tmp to prevent make a mess.

Thanks!

MaestroError commented 1 year ago

Strange, I think it should delete the temporary file right after execution. Sure, I will keep this issue open to remind me about it and I will update the package with the following fixes:

lon9man commented 1 year ago

It deletes it if everything gone successfully, but if we got error - then file remains in Project-root and developer should delete artifacts manually.. if it will be located in /tmp in any case it will be good solution

jdevinemt commented 6 months ago

Any update on this? I'm also experiencing this installing in a docker container (Ubuntu 20.04)

Screenshot 2024-03-20 at 5 03 17 PM

MaestroError commented 6 months ago

Hey @jdevinemt! Unfortunately not, I wasn't able to update it yet, but you can solve them easily by setting execution permission 👍