SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    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...

    Here is the problem...

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

    PHP Code:
    <?php
        
    // Initialize Session.
        
    session_start();

        
    // Access Constants.
        
    require_once('../config/config.php');

        
    // 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...
    Code:
    06_Debbie
    	Source Files
    		config
    		css
    		images
    		private
    		index.php
    
    	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?!


    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?!

    Sincerely,


    Debbie

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,200
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    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.

  3. #3
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    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...


    Debbie

  4. #4
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,136
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    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...


    Debbie
    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.

    MySite.com/
    - 06_Debbie
    - - Source Files
    - - - ...

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

  5. #5
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,200
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    I said that I am UNABLE to mimic the directory structure of my Production environment in NetBeans...
    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

    /home/accountname/public_html/

    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.

  6. #6
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    ralph.m,

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

    http://www.sitepoint.com/forums/show...otect-Database

    Sincerely,


    Debbie


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •