what you are looking for is abandoning the Android OS on them and flashing something akin to postmarketOS. This can still come with a workable touch-based GUI. But also just installing things like web-servers and php runtimes via a package-manager. Surprisingly broad support: https://wiki.postmarketos.org/wiki/Devices