The require_once statement in my code is not working on MAMP. The same code was working perfectly on WAMP earlier before I ported the project over.
require_once('class\validate_group.php');
The error I get with this is:
Warning: require_once(class\validate_group.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/validate_login.php on line 37
The phpinfo.php is showing the include path as:
.:/Applications/MAMP/htdocs
"class" is a folder inside htdocs
Strangely when I reverse the slash it starts reading the validate_group.php file. Will the reversed slashes still work in AWS where I am finally going to host this?
To answer your question, backslash in PHP is normally used to escape characters.
So you've escaped the \validate_group.php
file in your require_once
call.
You can use a pre-defined constant such as:
DIRECTORY_SEPARATOR
to avoid this in future.