We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon 4 project folder inside webroot result projectController handler class cannot be loaded

I've used phalcon 3.x a while. and i'm planning to switch to 4.0. But i'm facing problem regarding baseUri

My project is inside a webroot folder.

 /webroot
    /project

Using phalcon 3.4, it workes just fine, when i open

https://locallhost/project/

but when i use phalcon 4.0 an error occured

ProjectController handler class cannot be loaded

i have set

baseUri = /project/

but still not working

is this related to the

$router->handle($_SERVER['REQUEST_URI']);

or

$application->handle($_SERVER['REQUEST_URI'])->getContent();

?

how should i fix this ?



449
Accepted
answer

i've found the solution.

JJust change the $_SERVER['REQUEST_URI'] to

$router->handle($_GET['_url'] ?? '/');

or

$application->handle($_GET['_url'] ?? '/')->getContent();



81.1k

In my application "rema" the error persists

Notice: Undefined variable: application in C:\xampp\htdocs\rema\app\config\router.php on line 7

Fatal error: Uncaught Error: Call to a member function handle() on null in C:\xampp\htdocs\rema\app\config\router.php:7 Stack trace: #0 C:\xampp\htdocs\rema\public\index.php(26): include() #1 {main} thrown in C:\xampp\htdocs\rema\app\config\router.php on line 7