PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have config files containing $host, $dbname, $username and $passwords for different servers: local computer, stagging and production as the following:
In database.inc.php, I need to include this file for database access. In my local computer, I can have
include('config-local.php');
.....
However, if I want to put this application into the staging server, I have to change this as the following:
include('config-staging.php');
.....
There is better way????- I am using apache server. I can change those values for variables directly at staging or server but I think that is not good way
Any idea
Thanks for any help
sho
Last edited by johnhelen on Wed Mar 14, 2007 10:01 pm, edited 1 time in total.
However, in my local computer, I have a database name, username, pass for this application with data, But when I put this application into server, I need to have other names/pass.
I just always call it config.php and edit it for each system. I tend to keep config.php outside the application directory (which is separate from the public HTML directory) to make updates easier.
The way I am looking for is the way that I only need to upload those files into staging and server. Staging and server can findout the suitable config.php automatically. So I donot have to change value in staging and server.
arborint wrote:I just always call it config.php and edit it for each system. I tend to keep config.php outside the application directory (which is separate from the public HTML directory) to make updates easier.