Forgive me for I am not the best at describing setups such as this. That is why I have included a visual representation below of what I am trying to achieve. I'm developing an application that will use a central database. That central database is local to my server/website and connects by a php file. Now, the setup is to have client servers/websites connect to this same database by a php file. Except I need to find a way to give them that file without revealing the username and password to the database. Maybe some sort of encrypted file? But then if in the wrong hands that could possibly be decrypted? I'm open to any suggestions! Thanks!
Just make a php file with the function which your Client wants i don't think there is any other way to connect if you encode / encrypt it you have to give a key & when you give key it will be easily to decode/ decrypt for it so what you can do is make a php file with the function what your client wants and tell them to run function using php file
You're better off using another language for this, preferably a compiled one, such as C#. Unless someone goes out of their way to decompile the program, they won't be able to get your database details. If you still want to use PHP why not have a middle-man script that can accept and relay commands to/from the database? This way you don't need your clients to directly connect to the DB. For example: [Client's script] <-----HTTP POST request-----> [DB adapter] <-----> [DB] 1. User uses a form to send an SQL query 2. DB adapter script receives via $_POST 3. DB adapter script uses direct connect to execute the query 3. DB adapter sends result back to client This can also be done with sockets and would be a better method, but using HTTP is much easier.