local path config for developing

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!

Moderator: General Moderators

Post Reply
meandrew
Forum Commoner
Posts: 49
Joined: Mon Feb 24, 2003 1:03 pm

local path config for developing

Post by meandrew »

I have this error

Code: Select all

Fatal error: Failed opening required '/apache group/apache/htdocs/icanwork/classified/stdclassifieds/lib/func_common.php' (include_path='.;c:\php4\pear') in c:\program files\apache group\apache\htdocs\icanwork\classified\stdclassifieds\index.php on line 17
which is realted to the second bit of code below:

I know that it is the path and I am sure it it the method of path I am using but not sure how to proceed

This is one that works:

Code: Select all

if ($_SERVERї'SERVER_ADDR'] == "10.1.1.0") {

    // Development Server

    define ("DOCUMENT_ROOT", $_SERVERї'DOCUMENT_ROOT']);
    define ("SHOP_ROOT_PATH", DOCUMENT_ROOT . "/test/ukshopLIVE/shop");
    define ("SHOP_ROOT_URL", "/test/ukshopLIVE/shop");

} elseif (substr($_SERVERї'DOCUMENT_ROOT'],1,2) == ":/") {

    //localhost
    define ("DOCUMENT_ROOT", $_SERVERї'DOCUMENT_ROOT']);
    define ("SHOP_ROOT_PATH", DOCUMENT_ROOT . "/GO_LIVE/finished");
    define ("SHOP_ROOT_URL", "/GO_LIVE/finished");

} else {

    //greenwichorganicS Live Site 
    define ("DOCUMENT_ROOT", "/home/g/o/go/public_html"); // Live Server 
    define ("SHOP_ROOT_PATH", DOCUMENT_ROOT . "/shop");
    define ("SHOP_ROOT_URL", "/shop");
    require_once(DOCUMENT_ROOT . "/shared/html_helper.php");
    require_once(DOCUMENT_ROOT . "/shared/rprint.php");

}; // end if
and this is the one that doesn't work:

Code: Select all

// ************* START FUNCTION path_cnfg *************

function path_cnfg($the_key){

 
  $path_cnfg = array();

  
  /*****************************************
   *
   * DO NOT CHANGE ANYTHING 
   * ABOVE THIS POINT, 
   * UNLESS YOU KNOW WHAT YOU'RE
   * DOING.
   *

   *****************************************
   * Values *SHOULD* have a trailing slash.
   * The paths should be absolute, not relative.
   * Windows users should be able to use 
   * forward slashes(/) also, since php should 
   * take care of the difference.  
   *
   */

    /* Path to directory named "lib".
	 * You can put this directory above your 
	 * web root if you wish.
	 */
    $path_cnfgї'pathToLibDir'] = '/home/w/o/working/public_html/db/lib/'; 

    /* You probably either want to make 
	 * the cnfg directory password protected 
	 * or put it above your web root.
	 * This directory holds the file "cnfg_vars.php" 
	 * which holds information like your db password, etc.. 
	 */
    $path_cnfgї'pathToCnfgDir'] = '/home/w/o/working/public_html/db/cnfg/'; 


    /* This is not the path to the "admin" 
	 * directory.
	 * The directory named "admin" should stay 
	 * where it is, and the file named "index.php" 
	 * that is in the "admin" directory should stay there.
	 * This is the path to the directory 
	 * named "admin_scripts".  
	 * You can move this above your web root or 
	 * just leave it where it is and password protect it.
	 * The directory named "admin" that contains the "index.php" 
	 * file should also be password protected. 
	 */
	$path_cnfgї'pathToAdminScriptsDir'] = '/home/w/o/working/public_html/db/admin/admin_scripts/';

    /* Path to directory named "templates".
	 * You can put this directory above your 
	 * web root if you wish.
	 */	
	$path_cnfgї'pathToTemplatesDir'] = '/home/w/o/working/public_html/db/templates/';
    
   

  /* DO NOT CHANGE ANYTHING 
   * BELOW THIS POINT, 
   * UNLESS YOU KNOW WHAT YOU'RE
   * DOING.
   *
   ******************************************/


  return $path_cnfgї$the_key] ;


} // end function path_cnfg

// ************* END FUNCTION path_cnfg *************

?>
I am trying to understadn why the second one does not work and the first one does.

Some help would really be appreciated please

Andrew
meandrew
Forum Commoner
Posts: 49
Joined: Mon Feb 24, 2003 1:03 pm

Post by meandrew »

well blow me over with a feather duster!

All that I need to do was take away the path before the actual dir!

here it is and it works locally now :)

Code: Select all

// ************* START FUNCTION path_cnfg *************

function path_cnfg($the_key){

 
  $path_cnfg = array();

  
  /*****************************************
   *
   * DO NOT CHANGE ANYTHING 
   * ABOVE THIS POINT, 
   * UNLESS YOU KNOW WHAT YOU'RE
   * DOING.
   *

   *****************************************
   * Values *SHOULD* have a trailing slash.
   * The paths should be absolute, not relative.
   * Windows users should be able to use 
   * forward slashes(/) also, since php should 
   * take care of the difference.  
   *
   */

    /* Path to directory named "lib".
	 * You can put this directory above your 
	 * web root if you wish.
	 */
    $path_cnfgї'pathToLibDir'] = '/lib/'; 

    /* You probably either want to make 
	 * the cnfg directory password protected 
	 * or put it above your web root.
	 * This directory holds the file "cnfg_vars.php" 
	 * which holds information like your db password, etc.. 
	 */
    $path_cnfgї'pathToCnfgDir'] = '/cnfg/'; 


    /* This is not the path to the "admin" 
	 * directory.
	 * The directory named "admin" should stay 
	 * where it is, and the file named "index.php" 
	 * that is in the "admin" directory should stay there.
	 * This is the path to the directory 
	 * named "admin_scripts".  
	 * You can move this above your web root or 
	 * just leave it where it is and password protect it.
	 * The directory named "admin" that contains the "index.php" 
	 * file should also be password protected. 
	 */
	$path_cnfgї'pathToAdminScriptsDir'] = '/admin/admin_scripts/';

    /* Path to directory named "templates".
	 * You can put this directory above your 
	 * web root if you wish.
	 */	
	$path_cnfgї'pathToTemplatesDir'] = '/templates/';
    
   

  /* DO NOT CHANGE ANYTHING 
   * BELOW THIS POINT, 
   * UNLESS YOU KNOW WHAT YOU'RE
   * DOING.
   *
   ******************************************/


  return $path_cnfgї$the_key] ;


} // end function path_cnfg

// ************* END FUNCTION path_cnfg *************
thanks to all of those who were going to reply!

Andrew :)
Post Reply