PHP + Docker: Not uploading images

Have you defined the upload folder in your project settings as user uploads folder?

yes

don’t really understand why it doesn’t work

any errors during the upload? See the devtools in the browser, maybe enable server connect debug first

1 Like

can check George without errors

http://3.216.23.225/upload.php

I don’t see any errors, make sure you enable the errors in the upload step. Default it ignores any errors.

image

Optionally you could also enable output for the upload step, that could help debug the problem.

I don’t know how to give permission on aws / docker

I am having this issue. Did you ever get it resolved?

in my case it was a permission error on the folder

Thank you Adriano,
Ah ok, sounds similar. It seems that the folder permissions aren’t quite right with Docker and PHP when it’s initially configured. I know they can manually be changed, but that’s not what you should have to do, especially with Docker.

Thanks for coming back to me.

1 Like

The upload folder is not inside the docker image, it is mapped to a location on the host running docker. This is done, so that you don’t loose data when you update the docker image.

Thanks @patrick. That’s fine and makes perfect sense but the issue is, during the initialisation or the AWS instance/Docker image, that folder is not given write permission for the www-data user that the site runs as so uploads don’t work.

Seems this has different solutions in the docker world and specially the Apache php combination.

If you can find out which permission needed to be changed - do let me know so we can see if we can integrate those in our docker file

Hello Everyone!

Here I’m again with docker + PHP upload issues on Digital Ocean!! With node.js, works fine, but with PHP, permissions problems with assets folder!

Folder has full permission!

HELP! :exploding_head: :exploding_head:

@otavionestares could you also check the permissions inside the assets folder, you are trying to upload into a folder nf inside the assets folder which could have other permissions.

NodeJs runs under the root user if I’m correct, PHP/Apache in Docker runs under the user www-data. All folders created in the project are created using the root user and by default other users don’t have permissions to write to them.

1 Like

Yes! Work like a charm!!

Inside assets folder, chmod 777 [subfolder_name]

Thanks! Patrick!

For anyone struggling with this issue: I fixed it thanks to using this stackoverflow:

I do still believe something with the user uploads permissions in wappler with docker/php is not quite right. I suspect I now have to do this after each deploy.

Woohoo this issue is now fixed since the last update!

2 Likes

Yes indeed it is fixed in Wappler 4.5, as mentioned in the release notes: