-1
I have a php site hosted on a linux server in AWS, on the local server, which is windows, it is working normally, but hosted on this other server it does not work the requires.
I’m calling the pages like this:
require_once '../Model/model.php';
For testing, I just put that code on the same page, and the page gives this error:
If I give a header('location: ../Model/model.php')
it redirects to this right page, however the require
does not work, someone could give me a light, grateful already!
Edit: As requested, below is the folder structure:
The file that has this require code is inside the folder Controller
, and the requested file, within the Model
Make sure you have no problem with upper case and minuscule letters in the code and file names.
– rray
@rray, yes, I thought it could be this and it is correct, so much so that in the header it redirects
– Leonardo Walbrinch
Have you tried using the constant DIR before require? For example: require_once DIR . '../Model/model.php'; . In a moment the require error is in finding the file. __DIR (http://php.net/manualen/language.constants.predefined.php)
– ndr458
can be, I’ll give a check, thank you
– Leonardo Walbrinch
@elvex put it like this: require_once _ DIR _ '../Model/model.php'; but continued the page without responding(DIR with 2 underline and without the spaces between them)
– Leonardo Walbrinch
@Leonardowalbrinch Click on [Edit] and post the structure of your files. It gets easier.
– Valdeir Psr
@Valdeirpsr, I edited and put a photo and a description of how the structure is.
– Leonardo Walbrinch
@Leonardowalbrinch , her case controller be called by index php., use
require_once 'Model/model.php';
– Valdeir Psr
@Valdeirpsr, he’s called by the page
login.php
, inside the briefcaseView
. Another strange thing is that it does not pass of this requisition, below her I put to give aecho "a"
and thata
did not appear, but if I put before therequire
he appears.– Leonardo Walbrinch
Usa
echo __DIR__
to know which directory you are in.– Valdeir Psr
Is in
/var/www/html/Controller
, I was wrong before, is in Controller , not in View– Leonardo Walbrinch