r/PHPhelp • u/Available_Canary_517 • Jun 23 '25
Weird permission issue in php
I just had a very weird bug today So in my web app where each user gets their own image folder like images/1/, images/2/, up to images/12/. Everything was working fine except user 10 For some reason, uploads to folder 10 just failed. No errors, no logs, just nothing.i spent hours debugging paths, Apache configs, PHP logic but but to no help and the folder had 755 permission but after hours and re giving same permissions it started working, how does that even work
1
Upvotes
5
u/MateusAzevedo Jun 23 '25
No one knows. Something you did while trying to debug/fix the issue end up actually fixing it.
2
u/Big-Dragonfly-3700 Jun 23 '25
Is php's error_reporting set to E_ALL and either display_errors is set to ON or log_errors is set to ON, and you have confirmed these settings by requesting a script with a phpinfo() statement in it?
If you are having a permission problem, there would be a permission related php error at the move_uploaded_file() statement.
What is the size of the file you are trying to upload and does your upload handling code have useful error detection and validation logic? What is your upload handling code?
1
u/SevrinTheMuto Jun 23 '25
The problem being specific to "10" is making me wonder if digits were being split, i.e. into 1 and 0, and the 0 was considered empty in some expression so the files were being sent to images/1/. It's a long shot based on minimal info.
1
u/colshrapnel Jun 24 '25
FYI, it NEVER the case. When upload fails, PHP always has an error for you. What it ACTUALLY could be is you are silencing/not checking/not logging errors.
Then there will be the error message that would tell you what the problem was.
2
u/obstreperous_troll Jun 24 '25
Show.
Us.
The.
Code.