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 trialNikhil Khandelwal
9,371 PointsScreen blank on seeing preview of the code below (after adding functions for '/' page and '/contact' page)
$app = new \Slim\Slim();
$app->get(‘/‘, function(){ echo ‘This is Home Page’; });
$app->get(‘/contact‘, function(){ echo ’Feel Free to contact’; });
$app->run();
I am running this on my local machine (Mac air, using Mamp) and everything was working fine till
$app->get('/hello/:name', function ($name) { echo "Hello, $name"; });
Please help
3 Answers
lulzimgashi
4,493 PointsHi,
Did you try [localhost machine here]/index.php/hello/John
Is everything before $app->run(); that's important. You can enable debugging http://docs.slimframework.com/errors/debug/ -- Just make sure you enable debugging on your local machine as well, Check in your phpinfo() which php.ini actually is read, and modify display_errors = On
I tested this piece of code and everything works fine on my local machine.
Nikhil Khandelwal
9,371 PointsI am still stuck at this point as '/contact' is not working in spite of nearly everything tried.
Also, please let me know how to check phpinfo() and what do you mean by which php.ini is read.
Sorry, but I am a beginner here and a mechanical engineer, so very less idea.
lulzimgashi
4,493 PointsHi,
Did you mange to fix this? If not please can you follow this guide:
- Go to Applications/Mamp/bin/php/phpVERSION/conf/php.ini
- Set display_errors = On AND error_reporting=E_ALL
After this try running '/contact' and paste here the errors, or please attach a screenshot -- everything.