Hello, I'm trying to perform the challenges, but no matter how well my answer is, I get a connection rejection error in the test browser. The error is the following "a93.main-challenges.knpuniv... rejected the connection." What could it be??
Ah, sorry about that! Let me see if I can help :). First, if you try the challenge now, does the issue still happen? Does it happen any any coding challenge, or just this one?
Also, if you see the "rejected connection" again, could you try to copy that URL into your browser and see if it works? Make sure you have port :8000 at the end of the URL - so something like https://a93.main-challenges.knpuniversity.com:8000 (don't try that exact URL - it won't work - you get a new, unique URL for each new challenge - so use whatever the host name is in the error, if you see the error).
There are a few possible causes - the machine that's booted for you in the background may have been shut down, but you should get a clear error about this, so it's unlikely. Another possibility is that port 8000 (which is the port we use to talk to the server) is blocked by some firewall on your end).
when i go to test.php it works just fine but when i try to use /twig/index.php i get a ton of depricated errors. and in my homepage.php there are 2 red warnings and 22 yellow warnings, The other php files are completely fine. Can anyone help me figure this out?
This course is kinda old already and based on Twig v1, so it's OK to see some deprecations if you downloaded the course code and follow this course from there. It's not that much important from the point of learning Twig, so you can ignore deprecations here. But if you're talking about your private project - I would recommend you upgrade Twig and related components to the latest version. But before the upgrade, it would be great to fix those deprecations in case they are related to your own code, not to 3rd-party code. This way you will have much less BC breaks after the upgrade.
It's old and may show you some warnings... but you still can learn a lot from it and then will be able to use that knowledge in your personal projects. So just give it a try. Twig syntax is almost not changed in the newest version of Twig, for BC breaks we usually add notes to the tutorial saying what exactly was changed and what you should do in a newer version.
We also talk about Twig in other Symfony-related tutorials, e.g. https://symfonycasts.com/screencast/symfony/twig - probably better to use our advanced search to find more related info about Twig. But I would recommend you to start with those 2 courses first.
Hi, when I link the twig template to the controller I get the message 'template not found' I also don't get the autocompilation. How can I solve? I had already put templates as path folder in twig settings but the problems is still there. (I'm using symfony not drupal sorry maybe is the wrong place for ask this question)
Check Symfony settings in PHPStorm(Languages & Frameworks -> PHP -> Symfony) on main tab check directory paths, and on Container and Routing tabs push Reset to defaults, default file paths should appear. After it save settings, and probably try to restart PHPStorm with cache and index invalidation.
Hi, I keep getting this error when running index.php locally. test.php works fine, but this error doesn't seem to go away and I can't get it to work.. please help! This is with the standard start files by the way. Followed all the instructions in de README, but it keeps popping up.
Fatal error: Uncaught Twig_Error_Loader: Unable to find template ".twig" (looked into: C:\xampp\htdocs\twig/templates). in C:\xampp\htdocs\twig\vendor\twig\twig\lib\Twig\Loader\Filesystem.php:197 Stack trace: #0 C:\xampp\htdocs\twig\vendor\twig\twig\lib\Twig\Loader\Filesystem.php(133): Twig_Loader_Filesystem->findTemplate('.twig') #1 C:\xampp\htdocs\twig\vendor\twig\twig\lib\Twig\Environment.php(265): Twig_Loader_Filesystem->getCacheKey('.twig') #2 C:\xampp\htdocs\twig\vendor\twig\twig\lib\Twig\Environment.php(312): Twig_Environment->getTemplateClass('.twig', NULL) #3 C:\xampp\htdocs\twig\vendor\twig\twig\lib\Twig\Environment.php(288): Twig_Environment->loadTemplate('.twig') #4 C:\xampp\htdocs\twig\index.php(54): Twig_Environment->render('.twig', Array) #5 {main} thrown in C:\xampp\htdocs\twig\vendor\twig\twig\lib\Twig\Loader\Filesystem.php on line 197
Thanks for your reply! I have tried to that both in PHPStorm and by using the notepad program to create a homepage.twig file, yet it gives me the error anyway. For some reason it can't find the homepage.twig file, even thought it's there in the right directory (the templates folder).
Is there anything else I could try?
EDIT: Could it have something to do with the fact that C:\xampp\htdocs\twig/templates is being searched and the last 'slash' is a forward slash (/) instead of a backslash (\)?
For this particual project I use the built in PHP sever that I summon through the terminal with php -S localhost:8000. Otherwise I indeed use Apache :)
22 Comments
Hello, I'm trying to perform the challenges, but no matter how well my answer is, I get a connection rejection error in the test browser.
The error is the following "a93.main-challenges.knpuniv... rejected the connection."
What could it be??
Hey Nahuel!
Ah, sorry about that! Let me see if I can help :). First, if you try the challenge now, does the issue still happen? Does it happen any any coding challenge, or just this one?
Also, if you see the "rejected connection" again, could you try to copy that URL into your browser and see if it works? Make sure you have port :8000 at the end of the URL - so something like
https://a93.main-challenges.knpuniversity.com:8000(don't try that exact URL - it won't work - you get a new, unique URL for each new challenge - so use whatever the host name is in the error, if you see the error).There are a few possible causes - the machine that's booted for you in the background may have been shut down, but you should get a clear error about this, so it's unlikely. Another possibility is that port 8000 (which is the port we use to talk to the server) is blocked by some firewall on your end).
Let me know what you find out! Cheers!
when i go to test.php it works just fine but when i try to use /twig/index.php i get a ton of depricated errors. and in my homepage.php there are 2 red warnings and 22 yellow warnings, The other php files are completely fine. Can anyone help me figure this out?
Hey Gyro,
This course is kinda old already and based on Twig v1, so it's OK to see some deprecations if you downloaded the course code and follow this course from there. It's not that much important from the point of learning Twig, so you can ignore deprecations here. But if you're talking about your private project - I would recommend you upgrade Twig and related components to the latest version. But before the upgrade, it would be great to fix those deprecations in case they are related to your own code, not to 3rd-party code. This way you will have much less BC breaks after the upgrade.
Cheers!
Thanks, is there any tutorial where i can learn twig? i'm new at developing and i'd like to be able to do my own front end work.
thanks in advance!
Hey Gyro,
This tutorial is really the best one for learning Twig in deep: https://symfonycasts.com/screencast/twig
It's old and may show you some warnings... but you still can learn a lot from it and then will be able to use that knowledge in your personal projects. So just give it a try. Twig syntax is almost not changed in the newest version of Twig, for BC breaks we usually add notes to the tutorial saying what exactly was changed and what you should do in a newer version.
We also talk about Twig in other Symfony-related tutorials, e.g. https://symfonycasts.com/screencast/symfony/twig - probably better to use our advanced search to find more related info about Twig. But I would recommend you to start with those 2 courses first.
And you can refer to the official docs: https://twig.symfony.com/doc/3.x/ in case you prefer docs instead :)
I hope that helps!
Cheers!
What code editor are you using?
Hey hookedonweb_usa
The all mighty PHPStorm https://www.jetbrains.com/e...
Cheers!
Hi, when I link the twig template to the controller I get the message 'template not found' I also don't get the autocompilation. How can I solve? I had already put templates as path folder in twig settings but the problems is still there. (I'm using symfony not drupal sorry maybe is the wrong place for ask this question)
hey Gballocc7
Do you have Symfony plugin installed and activated in your PhpStorm settings?
Cheers!
Yes! I've fixed that problem but now I get missing assets! Everything run fine but I haven't the suggestions from the idle
Check Symfony settings in PHPStorm(
Languages & Frameworks -> PHP -> Symfony) on main tab check directory paths, and on Container and Routing tabs push Reset to defaults, default file paths should appear. After it save settings, and probably try to restart PHPStorm with cache and index invalidation.Cheers!
So, I have nothing coming up in my browser. Do you have an .sql file? I didn't see one in the code download. Thank you!
No .sql file needed, but I've just added a note to the top of this script about how to download the project and get it up and running locally :).
Cheers!
Hi, I keep getting this error when running index.php locally. test.php works fine, but this error doesn't seem to go away and I can't get it to work.. please help! This is with the standard start files by the way. Followed all the instructions in de README, but it keeps popping up.
Fatal error: Uncaught Twig_Error_Loader: Unable to find template ".twig" (looked into: C:\xampp\htdocs\twig/templates). in C:\xampp\htdocs\twig\vendor\twig\twig\lib\Twig\Loader\Filesystem.php:197 Stack trace: #0 C:\xampp\htdocs\twig\vendor\twig\twig\lib\Twig\Loader\Filesystem.php(133): Twig_Loader_Filesystem->findTemplate('.twig') #1 C:\xampp\htdocs\twig\vendor\twig\twig\lib\Twig\Environment.php(265): Twig_Loader_Filesystem->getCacheKey('.twig') #2 C:\xampp\htdocs\twig\vendor\twig\twig\lib\Twig\Environment.php(312): Twig_Environment->getTemplateClass('.twig', NULL) #3 C:\xampp\htdocs\twig\vendor\twig\twig\lib\Twig\Environment.php(288): Twig_Environment->loadTemplate('.twig') #4 C:\xampp\htdocs\twig\index.php(54): Twig_Environment->render('.twig', Array) #5 {main} thrown in C:\xampp\htdocs\twig\vendor\twig\twig\lib\Twig\Loader\Filesystem.php on line 197
Hey jjaimy
You have to manually create the `homepage.twig` file, so the loader can find it :)
Cheers!
Hi MolloKhan!
Thanks for your reply! I have tried to that both in PHPStorm and by using the notepad program to create a homepage.twig file, yet it gives me the error anyway. For some reason it can't find the homepage.twig file, even thought it's there in the right directory (the templates folder).
Is there anything else I could try?
EDIT: Could it have something to do with the fact that C:\xampp\htdocs\twig/templates is being searched and the last 'slash' is a forward slash (/) instead of a backslash (\)?
Ohh, interesting! I believe this is an error related to Windows, try this change
to
It still gives me the exact same error when going to localhost:8000/index.php, yet somehow it now DOES work when simply going to localhost:8000.
I have no idea why, but nonetheless I can continue the course this way, so as far as I'm concerned that's fixed! :)
Anyway, thank you so much for your help! <3
Oh, which web server are you using, apache? It's kind of weird that issue :)
For this particual project I use the built in PHP sever that I summon through the terminal with php -S localhost:8000. Otherwise I indeed use Apache :)
Cool :)
I'm glad you can keep going on with the course, but if you find the fix for that sneaky weirdo bug, let us know!
Cheers
"Houston: no signs of life"
Start the conversation!