Search code examples
phpmysqlinstallscript

Set MySQL config data on install PHP


I've made an install script for mysql tables. I want the user to set the database configurations. The configurations for mysql is hard coded in a PHP class as public variables.

What would be best practice for creating and storing the config data on install?


Solution

  • Use PHP fwrite() to create content to an empty PHP-file. Content is defined constants of users input. Use these constants to set value to the Database configuration file.