I have create a new application over a new server.
Everything seems ok and I have create a new project in _public_html_ folder, like:
phalcon project name --enable-webtools
Really seems everything is ok and the squeleton appears fine
To Reproduce
When I test http://www.mydomain.ext/name the response is:
NameController handler class cannot be loaded
#0 [internal function]: Phalcon\Mvc\Dispatcher->throwDispatchException()
#1 [internal function]: Phalcon\Dispatcher\AbstractDispatcher->dispatch()
#2 /home/tecmp/web/tecmp.com/public_html/name/public/index.php(55): Phalcon\Mvc\Application->handle()
#3 {main}
So, the line 55 of index.php is:
echo $application->handle($_SERVER['REQUEST_URI'])->getContent();
I have tested several ways in config.php
'baseUri' => '/',
or
'baseUri' => '/name/',
etc...
Expected behavior
The initial and automatic page/point of Phalcon. (controllers/IndexController.php)
Details
Additional context
The same new project in Phalcon 3.x works perfectly.
Thanks for your help in advance.
Hi @tallande,
Did you try to update the line 55 of index.php:
echo $application->handle($_SERVER['REQUEST_URI'])->getContent();
to
echo $application->handle($_GET['_url'] ?? '/')->getContent();
I hope it will solve your problem.
Hi, jenovateurs.
Thank you...
This really works perfectly.
Although I don't understand what the '??' means symbol because I couldn't find it in the documentation.
Could I have a slight explanation?
One more time. THANKS.
Hi, @tallande,
I'm glad that it works for you.
About the explanation, '??' is a PHP 7 operator called "Null Coalescing Operator".
For more information, you can go to this page : https://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.coalesce
The idea is simple, if $_GET['_url'] is empty, take the value '/' or take the value of $_GET['_url'].
@tallande closing this one. Feel free to drop by on discord or forum if you have more questions.
Thanks again, @jenovateurs
You'r right. It's PHP 7
Most helpful comment
Hi @tallande,
Did you try to update the line 55 of index.php:
echo $application->handle($_SERVER['REQUEST_URI'])->getContent();to
echo $application->handle($_GET['_url'] ?? '/')->getContent();I hope it will solve your problem.