I’m encountering issues with a personal project I’m developing. The problem arises when I attempt to “call” my Controller from my View in the MVC model. I receive this error message: “This page isn’t working. localhost is currently unable to handle this request.” This is my project structure:
12_MVC_CRUD
├── Controller
│ └── PlataformaController.php
├── Model
│ ├── DbConnection.php
│ └── PlataformaModel.php
└── View
├── footer.php
├── header.php
├── Idioma
│ └── IdiomaView.php
├── Pelicula
│ ├── PeliculaAddView.php
│ └── PeliculaView.php
├── Persona
│ └── PersonaView.php
├── Plataforma
│ ├── HomePlataformaView.php
│ ├── PlataformaConfiguracionView.php
│ ├── PlataformaView.php
│ └── testView.php
├── Serie
│ ├── SerieAddView.php
│ ├── SerieEditView.php
│ └── SerieView.php
├── Subtitulo
│ └── SubtituloView.php
└── testV.php
I’m trying to call “PlataformaController.php” from testView.php, which is inside the View folder > Plataforma. However, the logs are not clear to me.
When I use this command tail -n 100 php_error_log | grep testView, I get this output:
[08-May-2024 04:41:59 Europe/Berlin] PHP Fatal error: Uncaught Error: Failed opening required '/opt/lampp/htdocs/12_MVC_CRUD/View/Plataforma/../../../Controller/PlataformaController.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/12_MVC_CRUD/View/Plataforma/testView.php:3
thrown in /opt/lampp/htdocs/12_MVC_CRUD/View/Plataforma/testView.php on line 3
[08-May-2024 04:42:00 Europe/Berlin] PHP Warning: require_once(/opt/lampp/htdocs/12_MVC_CRUD/View/Plataforma/../../../Controller/PlataformaController.php): Failed to open stream: No such file or directory in /opt/lampp/htdocs/12_MVC_CRUD/View/Plataforma/testView.php on line 3
[08-May-2024 04:42:00 Europe/Berlin] PHP Fatal error: Uncaught Error: Failed opening required '/opt/lampp/htdocs/12_MVC_CRUD/View/Plataforma/../../../Controller/PlataformaController.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/12_MVC_CRUD/View/Plataforma/testView.php:3
thrown in /opt/lampp/htdocs/12_MVC_CRUD/View/Plataforma/testView.php on line 3
[08-May-2024 04:42:00 Europe/Berlin] PHP Warning: require_once(/opt/lampp/htdocs/12_MVC_CRUD/View/Plataforma/../../../Controller/PlataformaController.php): Failed to open stream: No such file or directory in /opt/lampp/htdocs/12_MVC_CRUD/View/Plataforma/testView.php on line 3
[08-May-2024 04:42:00 Europe/Berlin] PHP Fatal error: Uncaught Error: Failed opening required '/opt/lampp/htdocs/12_MVC_CRUD/View/Plataforma/../../../Controller/PlataformaController.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/12_MVC_CRUD/View/Plataforma/testView.php:3`
This is part of my code:
<?php require_once(“../../Controller/PlataformaController.php”); $obj = new PlataformaController(); ?>
Andres Sebastian Cabrera is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.