# Slim Error:A website error has occurred

**URL:** https://discourse.slimframework.com/t/slim-error-a-website-error-has-occurred/1299
**Category:** Questions
**Created:** [March 20, 2017, 8:03pm UTC](https://discourse.slimframework.com/t/slim-error-a-website-error-has-occurred/1299 "2017-03-20T20:03:37Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![SEGIO](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@SEGIO](https://discourse.slimframework.com/u/SEGIO)
#### Post date: [March 20, 2017, 8:03pm UTC](https://discourse.slimframework.com/t/slim-error-a-website-error-has-occurred/1299/1 "2017-03-20T20:03:37Z")

</div>

Hi guys again,  
i try again with another question, i get this error:“Error  
A website error has occurred. The website administrator has been notified of the issue. Sorry for the temporary inconvenience.”.  
How i can fix it please?  
Thanks in advance  
Test site link:[https://ghhh.000webhostapp.com/](https://ghhh.000webhostapp.com/)

---

<div class="post-metadata">

### Author: ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)
#### Post date: [March 20, 2017, 8:25pm UTC](https://discourse.slimframework.com/t/slim-error-a-website-error-has-occurred/1299/2 "2017-03-20T20:25:29Z")

</div>

You will need to have a look at your web server’s error log to find the error message.

---

<div class="post-metadata">

### Author: ![SEGIO](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@SEGIO](https://discourse.slimframework.com/u/SEGIO)
#### Post date: [March 20, 2017, 9:16pm UTC](https://discourse.slimframework.com/t/slim-error-a-website-error-has-occurred/1299/3 "2017-03-20T21:16:43Z")

</div>

thank you sir for your time but i don’t find any log file and i try it too with wampserver and the error persist.

 ![](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/63c7c57dabe8e3dd3df7f1697bd1415bd0691860.png)

exception ‘RuntimeException’ with message ‘View cannot render `login.php` because the template does not exist’ in C:\wamp64\www\vendor\slim\slim\Slim\View.php:272  
Stack trace:  
#0 C:\wamp64\www\vendor\slim\slim\Slim\View.php(255): Slim\View-\>render(‘login.php’, NULL)  
#1 C:\wamp64\www\vendor\slim\slim\Slim\View.php(243): Slim\View-\>fetch(‘login.php’, NULL)  
#2 C:\wamp64\www\vendor\slim\slim\Slim\Slim.php(755): Slim\View-\>display(‘login.php’)  
#3 C:\wamp64\www\index.php(113): Slim\Slim-\>render(‘login.php’)  
#4 [internal function]: {closure}()  
#5 C:\wamp64\www\vendor\slim\slim\Slim\Route.php(468): call\_user\_func\_array(Object(Closure), Array)  
#6 C:\wamp64\www\vendor\slim\slim\Slim\Slim.php(1355): Slim\Route-\>dispatch()  
#7 C:\wamp64\www\vendor\slim\slim\Slim\Middleware\Flash.php(85): Slim\Slim-\>call()  
#8 C:\wamp64\www\vendor\slim\slim\Slim\Middleware\MethodOverride.php(92): Slim\Middleware\Flash-\>call()  
#9 C:\wamp64\www\vendor\slim\slim\Slim\Middleware\SessionCookie.php(110): Slim\Middleware\MethodOverride-\>call()  
#10 C:\wamp64\www\vendor\slim\slim\Slim\Middleware\ContentTypes.php(81): Slim\Middleware\SessionCookie-\>call()  
#11 C:\wamp64\www\vendor\slim\slim\Slim\Slim.php(1300): Slim\Middleware\ContentTypes-\>call()  
#12 C:\wamp64\www\index.php(154): Slim\Slim-\>run()  
#13 {main}

---

<div class="post-metadata">

### Author: ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)
#### Post date: [March 21, 2017, 11:24am UTC](https://discourse.slimframework.com/t/slim-error-a-website-error-has-occurred/1299/4 "2017-03-21T11:24:58Z")

</div>

> [@](#):
>
> View cannot render login.php because the template does not exist

That is the first place I’d look. According to the trace, on line 113 of `C:\wamp64\www\index.php` you are calling `->render('login.php') but that file doesn't exist at that location. You will need to move your `login.php` file or change where you are telling it to look.

---

<div class="post-metadata">

### Author: ![SEGIO](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@SEGIO](https://discourse.slimframework.com/u/SEGIO)
#### Post date: [March 21, 2017, 6:44pm UTC](https://discourse.slimframework.com/t/slim-error-a-website-error-has-occurred/1299/5 "2017-03-21T18:44:35Z")

</div>

[details=Summary]\<?php  
require ‘/vendor/autoload.php’;  
require ‘/config.php’;

use lib\Core;  
use Gregwar\Captcha\CaptchaBuilder;  
/\*\*

- @var PDO  
_/  
$core = Core::getInstance();  
/_
- TODO guarda la struttura di [https://github.com/slimphp/Slim-Skeleton/blob/master/public/index.php](https://github.com/slimphp/Slim-Skeleton/blob/master/public/index.php)
- per spezzettare sto file eccessivamente ciccione  
_/  
/_\*
- 

\*/  
//$logWriter = new \Slim\LogWriter(fopen(’/var/www/html/slimlog’, ‘a’));

/\*\*

- @var $app \Slim\Slim  
\*/  
$app = new \Slim\Slim(array(  
‘debug’ =\> false,  
‘log.enabled’ =\> true,  
‘templates.path’ =\> ‘/templates’,  
// ‘log.writer’ =\> $logWriter  
’mode’ =\> ‘production’  
));  
$builder = new CaptchaBuilder;  
$app-\>add(new \Slim\Middleware\SessionCookie(array(‘secret’ =\> ‘myappsecret’, ‘expires’ =\> ‘30 minutes’)));  
$app-\>add(new \Slim\Middleware\ContentTypes());

const ROUTE\_DIR = ‘/routes/’;  
/\*\*

- @param $app \Slim\Slim
- @return Closure  
\*/  
$authenticate = function ($app) {  
return function () use ($app) {  
if (!isset($\_SESSION[‘id’])) {  
$\_SESSION[‘urlRedirect’] = $app-\>request()-\>getPathInfo();  
if (in\_array($\_SESSION[‘urlRedirect’], array("/test", “/elenco-risultati”, “/test-attivi”, “/single-test-prepare1”, “/single-test-prepare2”, “/pretest1”, “/pretest2”,"/single-test", “/single-test-captcha”)))  
$\_SESSION[‘urlRedirect’] = ‘/’;  
$app-\>flash(‘error’, ‘Login required’);  
$app-\>redirect(’/login’);  
}  
};  
};

/\*\*

- @param $app \Slim\Slim
- @return Closure  
\*/  
$authenticateAdmin = function ($app) {  
return function () use ($app) {  
if (!isset($\_SESSION[‘admin’])) {  
$app-\>redirect(’/’);  
} else {  
if ($\_SESSION[‘admin’] == false) {  
$app-\>redirect(’/’);  
}  
}  
};  
};  
$app-\>hook(‘slim.before.dispatch’, function() use ($app) {  
$user = null;  
if (isset($\_SESSION[‘user’])) {  
$user = $\_SESSION[‘user’];  
}  
$app-\>view()-\>setData(‘user’, $user);  
});

$app-\>get("/", function () use ($app, $core) {  
if (isset($\_SESSION[‘codice’]))  
unset($\_SESSION[‘codice’]);  
if (isset($\_SESSION[‘codiceazienda’]))  
unset($\_SESSION[‘codiceazienda’]);

```
try {
    $sql = "SELECT value FROM `impostazioni` WHERE name = 'tsecp'";
    $stmt = $core->dbh->prepare($sql);
    if($stmt->execute()) {
        $tsecp = $stmt->fetch(PDO::FETCH_ASSOC);
        if(!empty($tsecp)) {
            $var = doubleval($tsecp['value']);
            $_SESSION['tsecp'] = $var;
        }
    }

} catch (PDOException $e) {
    $errore = array('errore' => $e->getMessage());
    $app->render('errore_db.php', $errore);
}

try {
    $sql = "SELECT * FROM `impostazioni` WHERE type = 2";
    $stmt = $core->dbh->prepare($sql);
    if($stmt->execute()) {
        $row = $stmt->fetchAll(PDO::FETCH_ASSOC);
        foreach ($row as $_row) {
            $_SESSION[$_row['name']] = intval($_row['value']);
        }
    }

} catch (PDOException $e) {
    $errore = array('errore' => $e->getMessage());
    $app->render('errore_db.php', $errore);
}

if (!isset($_SESSION['user'])) {
    $app->render('login.php');
} else {
    $app->render('index.php');
}

```

});

$app-\>get("/testsession", $authenticateAdmin($app), function () use ($app) {  
echo ‘

```
’.print_r($_SESSION, true).’
```
’;  
});

$app-\>get("/showinput", $authenticate($app), function () use ($app) {

```
if (microtime(true) >= ($_SESSION['delaystarttime'] + $_SESSION['delaysec']))
    printf(1);
else
    printf(0);

```

});

$app-\>get("/errore", function() use ($app) {  
$app-\>render(‘errore.php’);  
});

// GestioneUtenti routes  
require **DIR**. ROUTE\_DIR . ‘GestioneUtenti.php’;

// SingleTest routes  
require **DIR**. ROUTE\_DIR . ‘SingleTest.php’;

// TestCollettivi routes  
require **DIR**. ROUTE\_DIR . ‘TestCollettivi.php’;

// Administration routes  
require **DIR**. ROUTE\_DIR . ‘Administration.php’;

// ClickAPremi routes  
require **DIR**. ROUTE\_DIR . ‘ClickAPremi.php’;

// REPORTS routes  
require **DIR**. ROUTE\_DIR . ‘Reports.php’;

$app-\>run();[/details]

this what i wrote from lines 112 to 116 :  
if (!isset($\_SESSION[‘user’])) {  
$app-\>render(‘login.php’);  
} else {  
$app-\>render(‘index.php’);  
}

And the path are:/Templates and there all files on there and i don’t any error
