Well firstly, you should be able to do that in Netbeans. I personally use PhpStorm, but I see no reason why Netbeans would not allow you to do this.
There's a way you can do this without changing any code at all between environments.
You need to use an apache environment variable. This is a variable that you setup in your apache virtual host config that is unique to each host. So for your production apache settings, you set the variable to "PRODUCTION", but for development, you can set it to "DEVELOPMENT" or whatever. You can then pickup this variable from within php, and from there you can have a case statement or whatever to determine which environment you're on, and therefore which configuration to use.
Version 1 of the Zend Framework uses this technique.
Here's a code snippet from the standard index.php file from ZF1:
// Define application environment
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
Here's a snippet from the apache virtual host settings:
SetEnv APPLICATION_ENV development
Allow from all
Notice the line "SetEnv APPLICATION_ENV development"? This is the line you need.
From there, you can use the getenv('APPLICATION_ENV') function to return "development" or "production", and from that variable you can determine which database settings to load in your own config. This should allow you to keep your code EXACTLY THE SAME in both production and development, yet still maintain different database settings for both.
In terms of where you should store the settings themselves - you are correct in storing them above your web root. You should be able to do this in Netbeans (could it be that you declared your project at the web root level in netbeans? If so, you may just need to create a "new" project in netbeans but just start one folder up when you set the project up).
I would highly recommend this method, as maintaining exactly the same code base between production and development makes things a whole lot easier in general.
Edit: I just saw this line in your own code:
So basically, you could just change that to this:
So long as you set the APPLICATION_ENV variable in your apache virtual host settings, you should now have your ENVIRONMENT variable dynamically set depending on which server you are on