Hi @chkpk8089 , it means the file you're referring does not exists. Best thing is to follow the path /Users/jcp/Desktop.... step by step to see where the problem is. Keep in mind the path must be exactly right, and can be case-sensitive based on your system.
PHP: "Failed to open stream: No such file or directory in..."
Hello, (huge) beginner PHP learner here.
For some damn reason, after having written required("./file/path"), it seems like I have "no such file or directory in" said path file.
Here's what I wrote:
require_once("./TestInc/testConfig.inc.php"); require_once("./TestInc/testPlayer.inc.php"); require_once("./TestInc/testMonsters.inc.php"); require_once("./TestInc/testLogic.inc.php");
Here's he error shown:
"jcp@MacBook Test % php TestFile.php PHP Warning: require_once(./testConfig.inc.php): Failed to open stream: No such file or directory in /Users/jcp/Desktop/Documents/Test/TestInc/testPlayer.inc.php jcp@MacBook Test % php TestFile.php PHP Warning: require_once(./testConfig.inc.php): Failed to open stream: No such file or directory in /Users/jcp/Desktop/Documents/Test/TestInc/testPlayer.inc.php jcp@MacBook Test % php TestFile.php PHP Warning: require_once(./testConfig.inc.php): Failed to open stream: No such file or directory in /Users/jcp/Desktop/Documents/Test/TestInc/testPlayer.inc.php jcp@MacBook Test % php TestFile.php PHP Warning: require_once(./testConfig.inc.php): Failed to open stream: No such file or directory in /Users/jcp/Desktop/Documents/Test/TestInc/testPlayer.inc.php jcp@Macbook Test % php TestFile.php PHP Warning: require_once(./testConfig.inc.php): Failed to open stream: No such file or directory in /Users/jcp/Desktop/Documents/Test/TestInc/testPlayer.inc.php jcp@Macbook Test % php TestFile.php PHP Warning: require_once(./testConfig.inc.php): Failed to open stream: No such file or directory in /Users/jcp/Desktop/Documents/Test/TestInc/testPlayer.inc.php on line 3
Warning: require_once(./testConfig.inc.php): Failed to open stream: No such file or directory in /Users/jcp/Desktop/Documents/PHP/Labs/Test/TestInc/testPlayer.inc.php on line 3 PHP Fatal error: Uncaught Error: Failed opening required './testConfig.inc.php' (include_path='.:/opt/homebrew/Cellar/php/8.1.6/share/php/pear') in /Users/jcp/Desktop/Documents/Test/TestInc/testPlayer.inc.php:3 Stack trace: #0 /Users/jcp/Desktop/Documents/Test/TestFile.php(4): require_once() #1 {main} thrown in /Users/jcp/Desktop/Documents/Test/TestInc/testPlayer.inc.php on line 3
Fatal error: Uncaught Error: Failed opening required './testConfig.inc.php' (include_path='.:/opt/homebrew/Cellar/php/8.1.6/share/php/pear') in /Users/jcp/Desktop/Documents/Test/TestInc/testPlayer.inc.php:3 Stack trace: #0 /Users/jcp/Desktop/Documents/Test/TestFile.php(4): require_once() #1 {main} thrown in /Users/jcp/Desktop/Documents/Test/TestInc/testPlayer.inc.php on line 3"
Please or to participate in this conversation.