rpieszak Posted March 25, 2007 Share Posted March 25, 2007 Hello all, My sites are hosted on Yahoo, and they have the following settings... auto_append_file = common_footer.inc auto_prepend_file = common_header.inc include_path = .:/include:/usr/lib/php If I put the common_footer.inc and common_header.inc into the root of the website, and browse to a root page, it works fine. But if I browse to any subfolders, it can't find them. What am I missing? Doesn't it defeat the purpose if you have to put these files in every directory? Any insight would be greatly appreciated. Thanks, Ryan Quote Link to comment Share on other sites More sharing options...
dswain Posted March 25, 2007 Share Posted March 25, 2007 If you have those files in the root of your directory, your code needs to point to those files all of the time. For example in your case since those files are in the root of your website (/) then you need to make sure you code points to the root of your website. If you just do an include with those files on each page, you're trying to tell PHP that the files are in the CWD and it won't be able to find them. Basically, just add the slash in front of the code (so instead of "include 'common_footer.php' make it "include '/common_footer.php'") Quote Link to comment Share on other sites More sharing options...
rpieszak Posted March 25, 2007 Author Share Posted March 25, 2007 I don't think I understand. I thought if the auto_*_file directive was set in the php.ini, there wasn't a need to manually include files in each of your pages. Quote Link to comment Share on other sites More sharing options...
trq Posted March 25, 2007 Share Posted March 25, 2007 You need to make the php.ini directives point to a full path. Eg; I would use.... auto_append_file = /home/thorpe/common_footer.inc Quote Link to comment Share on other sites More sharing options...
rpieszak Posted March 25, 2007 Author Share Posted March 25, 2007 Hmm, I was afraid you were going to say that. Given that I'm on a shared server at Yahoo, and cannot modify the php.ini file, am I stuck doing an include on every page? Quote Link to comment 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.