I had an issue yesterday with a project I’m coding. For whatever reason, I could not upload an image file to the server. My code updated the database, but the server wouldn’t take the upload. Now, I know the code is good. The permissions on the image file were fine. The “server” I’m uploading to was localhost, so I know for a fact the permissions were good on the server, in the web directory, and in the directory for the project. All that’s fine. I checked php.ini and, yeah, that’s good too.
But still, I can’t upload the damn image. It just won’t happen.
After a few choice words, I finally threw my hands up, shut down the virtual machine that I use for coding projects, got a beer, and stared into the distance.
I fired up the VM again this morning. I figure I’ll try again with fresh eyes. I ran through the workflow from the day before which has no variation because, frankly, I’ve only coded it for one workflow. Enter the data, browse for the image, click Submit…
And the goddamn thing works.
I changed nothing. I didn’t update a single character of a single line of code. Not only did I not edit anything, I didn’t even open Visual Studio Code. All I did was shut down the machine and turn it back on a day later and, believe me, that shouldn’t’ve made a damn bit of difference.
These are the bugs that drive me up a tree, because while it’s great that this thing is working now… what fixed it? Was it the reboot? If so, why? There were no changes to /var/www/html/ that required a reboot. The only commands I ran on that directory were chmod and chown. There was no git pull. Indeed I didn’t even push the damn code upstream because it’s broken, right? Something’s broken, because I couldn’t upload the image. No need to push shite code to the repo, because while it’s already got enough shite code in there but at least that stuff works.
What changed? What was wrong? What fixed the problem? And why?
Who knows?
I’m a computer programmer. And that’s why I drink.