I developed a web app that ran on a Mac localhost.
It used php solely to maintain the sqlite database.
The html file loaded the js which loaded all the database tables into arrays and when a table record was altered, added or deleted the php would handle it.
Apple no longer supports php so I need something to replace php.
Apple only removed the bundled PHP installation from macOS. PHP itself is still fully supported and works fine on a Mac.
So the easiest option is just to reinstall PHP and keep your existing architecture.
E.g.: using Homebrew:
brew install php
You can then either use PHP’s built-in development server:
php -S localhost:8000
Or integrate back into whatever local server setup you were already using.
If you do want a more modern replacement, Node.js with Express and SQLite would be a fairly common modern alternative, especially since your frontend is already JavaScript.
I do a reasonable amount with JavaScript, so I’d be happy to help if you decide to go down that route.
Why are you using your custom PHP code to maintain a database?. There are a lot of free SQL clients outhere that will be more powerfull than your app.
I personally use https://dbeaver.io/, community version. I can connect not just Sqlite, but Oracle, MySQL, etc.
I understood that more as “interact with” the database. E.g. the client requests that a record be added, updated, or deleted, and the PHP script carries out the operation.
You will of course require the database server, but DBeaver is a desktop app, so does not require a server itself to run. Unlike something like phpMyAdmin which runs in a browser requireing Apache and PHP to be run via server.
There are actually several desktop tools for databases like this. Just choose one you like.