Includes break between Dev and Production

I have been putting this issue off for a long time, but it looks like my judgement day has finally arrived… :frowning:

Here is the problem…

Right now, most of my scripts start off like this…

	// Initialize Session.

	// Access Constants.

	// Connect to Database.
	require_once(WEB_ROOT . 'private/database_settings.php');

Based on advice here at SitePoint, I have decided to move database_settings - and possibly config.php - to a directory OUTSIDE of the Web Root in Production.

The problem is that I don’t know how to create a directory outside of the “project” folder that NetBeans creates.

When I open NetBeans, this is what I see in the navigator…

	Source Files

	Include Path

It seems that Source Files represents my Web Root in NetBeans, and regardless of what I try, there is no way to create a directory outside of “Source Files” (i.e. Web Root).

So this creates the problem that there is no way to mimic in my Dev environment how things will look in Production, and that means all of my Includes will be broken when I switch over?! :frowning:

What are some different ways that I can address this issue?

Until I get this resolved, it makes no sense for me to finish testing my code, because if I have to switch things in Production, then all of my testing won’t mean anything, so I am a dead-duck-in-the-water until this gets resolved?! :frowning: :frowning: :frowning:



FWIW, I match the local main folder of my sites with the /home/ folder of the remote site, which includes /public_html/. That way, you can work with files above the root to probs.

Did you not read the problem in my original post?

I said that I am UNABLE to mimic the directory structure of my Production environment in NetBeans…


Take another read and read between the lines of ralph’s statement. He is saying you should have started another level up in your NetBeans project.

  • 06_Debbie
    • Source Files

And maybe even one more higher (depending on how your server is setup).

And I said that you probably ARE able to—although it depends more on your hosting account than NetBeans. I’m assuming that NetBeans includes FTP access.

Most web hosting accounts give you access to levels above the root folder (often called public_html). For example, they will tell you that your root folder is located at


Now, when you set up your FTP-enabled code editor to point to your hosting account, you have to nominate the remote path. If you specify it as /home/accountname/public_html/, then your code editor will only show you the files in /public_html/ and below. So if you want access to higher folders via FTP, nominate the remote path as /home/accountname/. That way, when you open the FTP connection, you wil be presented with all the files in the /accountname/ folder, which will include /public_html/, but also a ton of other stuff. Then you can work at that level or below.

So that the local files match the remote ones, I have a folder on my desktop that matches /home/accountname/, and inside that is the /public_html/ folder.

The only rider to all this is that your host may not give you control panel access to folders above the root folder. If they don’t, politely ask for your money back and get a better web host. :slight_smile:


I figured things out - with a lot of help from cpradio - in this thread here…