简体   繁体   中英

php failed to open stream

I have an error, I think it has to do with the directory of the public_html file but I'm not sure.

The Error:

Warning: require(__DIR__/protected/bootstrap/autoload.php) [function.require]: failed to open stream: No such file or directory in /home4/nameguy/public_html/index.php on line 21

Warning: require(__DIR__/protected/bootstrap/autoload.php) [function.require]: failed to open stream: No such file or directory in /home4/nameguy/public_html/index.php on line 21

Fatal error: require() [function.require]: Failed opening required '__DIR__/protected/bootstrap/autoload.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home4/nameguy/public_html/index.php on line 21

Index.php code:

<?php
require __DIR__.'/protected/bootstrap/autoload.php';

$app = require_once __DIR__.'/protected/bootstrap/start.php';

$app->run();

$app->shutdown();

__DIR__ is only defined since PHP 5.3 so maybe you have an older version. You can use __FILE__ instead:

<?php
require dirname(__FILE__).'/protected/bootstrap/autoload.php';

$app = require_once dirname(__FILE__).'/protected/bootstrap/start.php';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM