0
Hello, no require error happens:
Warning: require(./funcs/FuncSQL.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/Lucktor/pages/home.php on line 42
Fatal error: require(): Failed opening required './funcs/FuncSQL.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/Lucktor/pages/home.php on line 42
But as you can see in the image below he is there:
I set the path like this
define ("DIR_PAGES", DIR.'pages/');
And I call it this way:
require DIR_FUNCS.'FuncSQL.php';
And you’re calling the file
FuncSql.php
insidepages/home.php
? If yes, try../funcs/FuncSql.php
. Or use$_SERVER['DOCUMENT_ROOT'].funcs/FuncSQL.php
– Max Rogério
When I tried
../funcs/FuncSQL.php
nothing changed and when I used$_SERVER['DOCUMENT_ROOT'].funcs/FuncSQL.php
just appeared more mistakes.– Lucas Caresia
This is misdirection... Try to do the following test... do
echo $_SERVER['DOCUMENT_ROOT'].'/funcs/FuncSQL.php'
and see if the directory he shows this correct... In my previous comment I forgot to put the/ <- barra
beforefuncs
, must be because of the error. But this error is of wrong file include pointing.– Max Rogério
I think I found the problem, it’s returning
/opt/lampp/htdocs/funcs/FuncSQL.php
, and should return/opt/lampp/htdocs/Lucktor/funcs/FuncSQL.php
– Lucas Caresia
Usually the
$_SERVER['DOCUMENT_ROOT']
brings the path to the root folder. If you solved the problem closes the question.– Max Rogério
@Maxrogério I used this way
require '/opt/lampp/htdocs/Lucktor/funcs/FuncSQL.php';
and keeps returning the same error.– Lucas Caresia
Let’s go continue this discussion in chat.
– Lucas Caresia