woolyg Posted November 11, 2007 Share Posted November 11, 2007 Hi all, Pretty sure this has been asked before, but I can't find conclusive help on it. I've got a file structure -www (containing normal site files) -www/inc (containing includes like db.php, session.php etc) -www/accounts (containing an area for customer login) I'm working on www/accounts/signup.php and am trying to use the following code: <?php include "/inc/session.php"; ?> ...so that certain session elements can be set. however, I'm getting an error Warning: include(/inc/session.php) [function.include]: failed to open stream: No such file or directory in E:\XAMPP\xampp\htdocs\mysite\accounts\signup.php on line 3 (I'm using Xampp as a testing server as well as my live server) - I've tried various combo's of paths to the sessions file, but the server is not allowing a proper include to it. How can I fix this? Thanks, Woolyg Link to comment https://forums.phpfreaks.com/topic/76831-solved-includeing-to-a-different-folder/ Share on other sites More sharing options...
PHP_PhREEEk Posted November 11, 2007 Share Posted November 11, 2007 Have you tried include "inc/session.php"; If that doesn't work, try backslash instead of forward slash...? PhREEEk Link to comment https://forums.phpfreaks.com/topic/76831-solved-includeing-to-a-different-folder/#findComment-388985 Share on other sites More sharing options...
woolyg Posted November 11, 2007 Author Share Posted November 11, 2007 I've tried those combinations, but no joy. Can anyone shed some light please? Any help appreciated..it's saying ..No such file or directory in /home/myact/public_html/mysite/accounts/signup.php on line 2 Woolyg Link to comment https://forums.phpfreaks.com/topic/76831-solved-includeing-to-a-different-folder/#findComment-388987 Share on other sites More sharing options...
woolyg Posted November 11, 2007 Author Share Posted November 11, 2007 The painful thing is, that if I add an INC folder to my www/accounts folder, the linking works... but I don't wanna have to add the INC folder to every added folder on the site!!!! Wah! Link to comment https://forums.phpfreaks.com/topic/76831-solved-includeing-to-a-different-folder/#findComment-388999 Share on other sites More sharing options...
woolyg Posted November 11, 2007 Author Share Posted November 11, 2007 Think I've cracked it. The issues with the includes were actually problems with the includes INSIDE the included files (if that makes sense). I put in absolute paths for them and all worked ... so far! Solved Link to comment https://forums.phpfreaks.com/topic/76831-solved-includeing-to-a-different-folder/#findComment-389001 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.