1

I am using CakePHP 2.8x . In webroot I am calling a php which needs to require

require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/lib/Cake/bootstrap.php');

My script gets executed till this line. From this line the script halts without producing any error. I tried

if ( file_exists(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/lib/Cake/bootstrap.php')){
    echo "file exits";
    require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/lib/Cake/bootstrap.php');
    echo "file ";
}
else{
    echo "file not found";
}

Here I get file exists but donot get file

Then I tried

if (!require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/lib/Cake/bootstrap.php')){
    echo "file included";
}
else{
    echo "file not included";
}

but here I don't get any output here.

  • Are you sure you've looked for errors in the right place? See the tips here: https://stackoverflow.com/q/845021/157957 – IMSoP May 10 '21 at 17:58
  • 1
    Either a parse error with error reporting turned off, or an endless loop. Either way, use xdebug to investigate. Good luck. – Mike Doe May 10 '21 at 17:58
  • As an aside, you can reduce one level of nesting by using `__DIR__` instead of `dirname(__FILE__)`, and replace the others with `/../`, giving `__DIR__ . '/../../../../lib/Cake/bootstrap.php'` – IMSoP May 10 '21 at 17:59
  • 1
    Hang on, is that space before the `F` in `__ FILE__` there in your actual code? Because if so, that's your error. – IMSoP May 10 '21 at 18:01
  • space b/w file __ F is is a typo here. but that's not the cause here. I think this has something to do with bootstrap file in cakephp. I am not sure what it is – Akshad Gandhi May 17 '21 at 05:16

0 Answers0