Include 'repldb.php' not working

I am trying to use ReplDB in my PHP project, but when I try to use include "repldb.php"; in the first line of my file, it doesn’t work. The file repldb.php exists, and I don’t have any syntax errors. Here are the errors I’m getting:

Warning: include(repldb.php): Failed to open stream: No such file or directory in /home/runner/Elemental-Conquest/play/conquest/plains/index.php on line 2

Warning: include(): Failed opening 'repldb.php' for inclusion (include_path='.:/nix/store/0cqzc3525991mwba1762xbryq6llwrzm-php-8.2.0/lib/php') in /home/runner/Elemental-Conquest/play/conquest/plains/index.php on line 2

Repl link:

File where the issue is happening: play/conquest/plains/index.php

Did you tried to use absoluth path?

For example instead of using include "repldb.php"; try to use include __DIR__ . "/repldb.php";

1 Like

I just noticed that you have multiple index.php files. Try to change the name of the other files (like index1, index2) or something like that. It makes less confusing

1 Like

That doesn’t seem to be changing, did I do something wrong?

I’m using index.php for all of them because it is the page the user goes to when they don’t specify a specific file.

Try to include the repldb.php inside the same folder of play/conquest/plains/index.php

I can’t do that because I will have to use repldb.php in other files not in play/conquest/plains.

Ok, it seems I did it using this:

include __DIR__ . "/../../../repldb.php";

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.