joymis Posted September 5, 2017 Share Posted September 5, 2017 Hello, I have a web dirs like this / obj/ a.php b.php c.php test/ d.php Contents of these files: d.php: require_once '../obj/a.php'; a.php: require_once 'b.php'; b.php: require_once 'c.php'; then I run d.php, the log display: PHP Warning: require_once(c.php): failed to open stream: No such file or directory in /var/www/xxx/test/b.php PHP Fatal error: require_once(): Failed opening required 'c.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/xxx/test/b.php Is there something obvious I'm missing? how do include paths work in PHP? thanks. Link to comment Share on other sites More sharing options...
Gabrielphp Posted September 5, 2017 Share Posted September 5, 2017 I think you're missing something to tell us. I've recreated the same environment as yours and also added an echo "Ok!"; in the c.php and at me it works fine, exactly the same settings as yours. As i did it, i used Windows to do it, so it might aswell be the thing that you're using linux, and it might be possible that the paths don't work as are working in windows. Try putting the "../obj/c.php"; as path in the b.php althought you have it in the same directory and see if that works, if not then i don't know what should work as on my pc (windows) works just fine. Link to comment Share on other sites More sharing options...
justsomeguy Posted September 5, 2017 Share Posted September 5, 2017 Since you're only getting an error about c.php and not about b.php, it works like you expect but you probably had a typo somewhere, or you put the file somewhere else by mistake. Link to comment Share on other sites More sharing options...
joymis Posted September 6, 2017 Author Share Posted September 6, 2017 Thank you for your help I tried delete old dir and then upload the same dir and files again, it is can work. but I still don't know why this happened... Link to comment Share on other sites More sharing options...
justsomeguy Posted September 6, 2017 Share Posted September 6, 2017 Maybe something happened during the first upload. There's nothing wrong with the code. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now