It's a cute dream to have - running some kind of webserver/API/IoT service off an old phone, but in my experience it's not as easy as it sounds.
I had a little fleet of phones doing some IoT-like operation but they eventually all went offline, restarted, or just developed wonky issues.
Cell phones simply do not like being powered on 24/7 and actively doing things - they are used to being used for a bit, then off. It gets worse as the battery ages, of course - and maybe that's the main reason for the failures.