View Single Post
Old 01-14-2025, 07:54 PM  
cerulean
Web & App Development
 
cerulean's Avatar
 
Industry Role:
Join Date: Oct 2023
Location: United States
Posts: 122
Quote:
Originally Posted by Killswitch View Post
For the record, the overhead of executing PHP to run file commands like unlink while is overhead, it's negligible and you shouldn't complicate things for yourself because someone else's preferences.
This isn't the first time this has come up for me personally, and I stand by what I've said. The OP is using readdir, unlink, and pathinfo, and while you are focusing specifically on unlink, all three in tandem across multiple files can compound memory and resource issues. Without benchmarking it, I couldn't definitively say so, but my experience tells me that using find would be a lot more performant and would answer OPs request.

I don't know if the host is being honest, and I am not sure of the underlying system allocation, but there is truth to what I'm saying, and it's not necessarily negligible. PHP handles its own memory optimization and garbage collection, and there's not much you can do to make these more performant. It's already a very performant language. That doesn't mean it can handle large file operations with ease. It's not the right tool for the right job, in this case, in my opinion.

I was looking for some of the old threads and expert opinions I researched when I was attempting to optimize a phar executable for code obfuscation purposes, but I think most of those old forums are now defunct. My bookmarks were dead, but these SO posts shed some light on how file operations can be resource hogs in PHP, if you're interested in reading them. The bit on unlink not being asynchronous is very interesting.

https://stackoverflow.com/q/6627952

https://stackoverflow.com/q/37633680

https://stackoverflow.com/questions/...nous-functions

We can differ on this and have our own opinions, but I do stand by mine.

Quote:
Originally Posted by Publisher Bucks View Post
Wow, I’m so glad that people are getting offended on my behalf about a host shutting down a cron job on a $2 a month shared hosting plan that is only used for image generation… Classic GFY (and a good example of why society as a whole is failing).
I would not mind knowing the name of a managed shared hosting platform that offers $2/mo plans with cronjob support. That sounds like a diamond in the rough.
__________________
Cerulean Software Specializes in Website and App Development. Email me today!

Keep Your Business and Members Area Secure with LoginBlue Password and Content Protection
cerulean is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote