-1

Possible Duplicate:
failed to open stream: Invalid argument

// Define the core paths
// Define them as absolute paths to make sure that require_once works as expected

// DIRECTORY_SEPARATOR is a PHP pre-defined constant
// (\ for Windows, / for Unix)
defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR);

defined('SITE_ROOT') ? null : 

define('SITE_ROOT', DS.'C:'.DS.'wamp'.DS.'www'.DS.'photo_gallery');

defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes');

// load config file first
require_once(LIB_PATH.DS.'config.php');

// load basic functions next so that everything after can use them
require_once(LIB_PATH.DS.'functions.php');

// load core objects
require_once(LIB_PATH.DS.'session.php');
require_once(LIB_PATH.DS.'database.php');

// load database-related classes
require_once(LIB_PATH.DS.'user.php');

Whenever, i tried to run this code by typing in my address bar localhost/photo_gallery/public/admin/index.php. It will display an error like this:

Warning: require_once(\C:\wamp\www\photo_gallery\includes\config.php): failed to openstream: Invalid argument in C:\wamp\www\photo_gallery\includes \initialize.php on line 16.

Fatal error: require_once(): Failed opening required '\C: \wamp\www\photo_gallery\includes\config.php'(include_path='.;C:\php\pear') in C:\wamp\www\photo_gallery\includes\initialize.php on line 16

Please, tell me what to do? Am a beginner startup webdesigner and am getting stuck with this fatal error.

Community
  • 1
  • 1
  • Use define instead of defined – Hkachhia Dec 07 '12 at 06:28
  • so many duplicates: http://stackoverflow.com/questions/13759360/fatal-error-require-once-failed-opeining-required-c-wamp-www-photo-gallery, http://stackoverflow.com/questions/13759794/require-once-failed-to-openstream-invalid-argument-in-c-wamp-www-photo-gall#13759794 – Zathrus Writer Dec 07 '12 at 08:59
  • The answer you were given explains your error perfectly. We don't spoonfeed people, the error is that the file doesn't exist. Now deal with it however you'd like. – Madara's Ghost Dec 07 '12 at 09:01

1 Answers1

0

DS is extra in following line:

define('SITE_ROOT', DS.'C:'.DS.'wamp'.DS.'www'.DS.'photo_gallery');

Please remove it so it become

define('SITE_ROOT', 'C:'.DS.'wamp'.DS.'www'.DS.'photo_gallery');

use define instead defined

Uttam Kadam
  • 458
  • 1
  • 7
  • 20