user3555497
user3555497

Reputation: 11

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();

Upvotes: 1

Views: 1531

Answers (1)

laurent
laurent

Reputation: 90863

__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';

Upvotes: 2

Related Questions