spires Posted January 6, 2011 Share Posted January 6, 2011 Hi I have this bit of code: defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); defined('SITE_ROOT') ? null : define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']); defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes'); That i'm using so all systems can always find my class and important files. This works fine on on of my websites, but I have just moved it over to another website (exact setup & on same server) and it is not working!!! I'm getting the error: Warning: require_once(/includes/functions.php) [function.require-once]: failed to open stream: No such file or directory in /home/a/d/adele/web/public_html/includes/initialize.php on line 9 Fatal error: require_once() [function.require]: Failed opening required '/includes/functions.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/a/d/adele/web/public_html/includes/initialize.php on line 9 Basically, all my important files are in the initialize.php file. So I only need to call that one file on any of my html pages. I know it's DOCUMENT_ROOT, as when I remove this and link direct it works fine. Thanks for any help Quote Link to comment https://forums.phpfreaks.com/topic/223556-document_root-help-needed/ Share on other sites More sharing options...
quasiman Posted January 6, 2011 Share Posted January 6, 2011 I get that sometimes if my file permissions are not set right. Quote Link to comment https://forums.phpfreaks.com/topic/223556-document_root-help-needed/#findComment-1155604 Share on other sites More sharing options...
spires Posted January 6, 2011 Author Share Posted January 6, 2011 They are 755 What should they be set to? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/223556-document_root-help-needed/#findComment-1155605 Share on other sites More sharing options...
quasiman Posted January 6, 2011 Share Posted January 6, 2011 files should be 644, directories are 755 Quote Link to comment https://forums.phpfreaks.com/topic/223556-document_root-help-needed/#findComment-1155606 Share on other sites More sharing options...
spires Posted January 6, 2011 Author Share Posted January 6, 2011 Yes. The folder 'includes' is 755 and all files in the inside the folder are 644 Anyother ideas? Quote Link to comment https://forums.phpfreaks.com/topic/223556-document_root-help-needed/#findComment-1155608 Share on other sites More sharing options...
trq Posted January 6, 2011 Share Posted January 6, 2011 Have you actually added these paths to your include_path or how are you trying to include files? Quote Link to comment https://forums.phpfreaks.com/topic/223556-document_root-help-needed/#findComment-1155614 Share on other sites More sharing options...
spires Posted January 6, 2011 Author Share Posted January 6, 2011 Yes: initialize.php: <?PHP defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); defined('SITE_ROOT') ? null : define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']); defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes'); require_once(LIB_PATH.DS."config.php"); require_once(LIB_PATH.DS."functions.php"); // core objects require_once(LIB_PATH.DS."session.php"); require_once(LIB_PATH.DS."database.php"); require_once(LIB_PATH.DS."pagination.php"); require_once(LIB_PATH.DS."PHPMailer".DS."class.phpmailer.php"); require_once(LIB_PATH.DS."PHPMailer".DS."class.smtp.php"); // related classes require_once(LIB_PATH.DS."profile_user.php"); require_once(LIB_PATH.DS."blog.php"); require_once(LIB_PATH.DS."blog_img_signup.php"); require_once(LIB_PATH.DS."blog_categories.php"); ?> In HTML file require_once("../../../includes/initialize.php"); Quote Link to comment https://forums.phpfreaks.com/topic/223556-document_root-help-needed/#findComment-1155639 Share on other sites More sharing options...
trq Posted January 6, 2011 Share Posted January 6, 2011 Yes what? There is nothing there that puts any paths on your include path. How about.... <?php defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); defined('SITE_ROOT') ? null : define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']); defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes'); set_include_path(get_include_path() . PATH_SEPARATOR . LIB_PATH); require_once("config.php"); require_once("functions.php"); // core objects require_once("session.php"); require_once("database.php"); require_once("pagination.php"); require_once("PHPMailer".DS."class.phpmailer.php"); require_once("PHPMailer".DS."class.smtp.php"); Then instead of.... require_once("../../../includes/initialize.php"); which should have been.... require_once(LIB_PATH.DS."initialize.php"); anyway shouldn't it? You can now use.... require_once("initialize.php"); Quote Link to comment https://forums.phpfreaks.com/topic/223556-document_root-help-needed/#findComment-1155656 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.