Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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

http://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 ?



349
Accepted
answer

i've found the solution.

JJust change the $_SERVER['REQUEST_URI'] to

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

or

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



75.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