my other require once php page gets error when i call it in index

99 Views Asked by At

I get this error when I try to call product_class.php in index.php. My product_class.php works fine, but when I try to add it to index this error show up:

Warning: require_once(../Includes/config/general.php): failed to open stream: No such file or directory in D:\Programming\Web\xampp\htdocs\android-api\product\product_class.php on line 2

Fatal error: require_once(): Failed opening required '../Includes/config/general.php' (include_path='D:\Programming\Web\xampp\php\PEAR') in D:\Programming\Web\xampp\htdocs\android-api\product\product_class.php on line 2

here my code at index.php

<?php

require_once('product/product_class.php');
require_once('Includes/config/general.php');
require_once INCLUDES_DIR.'/database.php';

?>
1

There are 1 best solutions below

0
emrez On

Make sure you specify the correct file path. If the index.php file and the product or Includes folder are in the same folder, try this:

require_once __DIR__ . '/product/product_class.php';
require_once __DIR__ . '/Includes/config/general.php';