Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBen Os
20,008 PointsI can't have the special Slim-PHP 404 error page that I should have
I took the PHP track and I do the course "Building websites with PHP" with Hampton Paulk:
I rewrote the relevant code Hampton showed In the second lecture (I wrote it in index.php). But, when I previewed the workspace, I didn't see the special 404 page Hampton had, but rather a code error:
" Fatal error: Uncaught Error: Class 'Slim\Slim' not found in /home/treehouse/workspace/index.php:6 Stack trace: #0 {main} thrown in /home/treehouse/workspace/index.php on line 6 "
Here is my code:
<?php
require 'vendor/autoload.php';
date_default_timezone_set('Asia/Jerusalem');
$app = new \Slim\Slim();
$app->get('/hello/:name', function ($name) {
echo "Hello, $name";
});
$app->run();
?>
Here is a snapshot of my code:
Here is a link to my homepage with the error:
Ben Os
20,008 PointsHelo Alena, I've tried typing composer update (without any further syntax) in the console and when the update process finished I tried to fully refresh (CTRL+F5) my preview\homepage but the same error still occurs.
I've updated the question with further details in it's end.
Alena Holligan
Treehouse TeacherChange your slim version in your composer.json file
"slim/slim": "~2.6"
Then run composer update again, and make sure you are going to the full path, like http://port-80-4fvfqngcqw.treehouse-app.com/hello/ben
Ben Os
20,008 PointsWorked, much thanks !!!
Alena Holligan
Treehouse TeacherAlena Holligan
Treehouse Teachercan you try a "composer update" in the console or create a "snapshot" and share that here so we can see your code.