Avoid embedding configuration information in your code The other idea I try to stress is the idea of not placing configuration information within your code. Examples of this would be database access information, filepaths, and hostnames. Placing this information in your code just makes it more difficult in the future if you ever need to change it. Similar to using constants instead of string constants, using some sort of external configuration makes it so that when the rest of the world changes, you don't have to scramble through your code with grep or sed to fix things. Additionally, when deploying between development and production environments, it often requires you to make certain changes. The filesystem on one machine may be different, or you may need to point your application to a production database instead of a development database you've been using for hacking. In the typical LAMP setup, Apache's .htaccess file is the place to do this kind of dirty work. Using the SetEnv directive, you can set up environment variables to use throughout your application. For example: .htaccess SetEnv MYSQL_HOST localhost SetEnv MYSQL_USER username SetEnv MYSQL_PASSWORD password SetEnv MYSQL_DATABASE phonebook A library handling your MySQL stuff, per se, mysql.php This methodology gives you a lot of flexibility when it comes to changing how external resources for your application are configured when the time comes. I find that particularly is medium-sized to enterprise environments, this is particularly important when there may be multiple developers working on a project kept in some version control archive and built in several different development environments (e.g. your desktop), and each development instance needs to be configured separately. However, even in a small or single-developer environment, it's a good practice to adopt so that if and when your project grows, you're already prepared. Another thing to notice in the mysql.php example is the if ... test at the very top. It's also not a bad practice to provide defaults within your application so that the server configuration variables override the application defaults if they are set, but that the application itself falls back on some default configuration otherwise.