boxturt Posted October 8, 2005 Posted October 8, 2005 Pages and pages of the same error happening on 100's of different pages >[Fri Oct 7 19:57:16 2005] [error] PHP Warning: main(): Failed opening '/usr/local/apache/htdocs/alpha/songs/includes/google_ads.inc' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/lyricsp/public_html/alpha/songs/k/knots.shtml on line 76 [Fri Oct 7 19:57:16 2005] [error] PHP Warning: main(/usr/local/apache/htdocs/alpha/songs/includes/google_ads.inc): failed to open stream: No such file or directory in /home/lyricsp/public_html/alpha/songs/k/knots.shtml on line 76 I'm using regular php includes which has been working fine for months and months ><?php include $_SERVER['DOCUMENT_ROOT']."/alpha/songs/includes/google_ads.inc"; ?> The files do exist, and they do display with the page. To me the error message itself looks odd, mostly the paths mentioned. I think I've been staring at it too long. Any thoughts are always greatly appreciated. Thanks! Quote
boxturt Posted October 8, 2005 Author Posted October 8, 2005 (edited) But wait - there's more!! Ok, I did some more thinking and it looks like all my content (almost 30,000 pages) is getting indexed by Google (at least) two ways. The first listing reads "Supplemental Result" and is listed by ip/~user/........ followed by a regular listing. Try both of these and you'll see... 207.44.240.63/~lyricsp/alpha/songs/g/greenwoodcreek.shtml lyricsplayground.com/alpha/songs/g/greenwoodcreek.shtml It's the first one causing errors. Why?? And why is it even listed there?? Anyway - do I need to put some sort of redirect in .htaccess? Is that even the thing to do and how? Thanks again. Edited October 8, 2005 by boxturt Quote
TCH-Andy Posted October 8, 2005 Posted October 8, 2005 Hi Boxturt, It's because you are including the file by reference - the clue is in the error >Failed opening '/usr/local/apache/htdocs/alpha/songs/includes/google_ads.inc' for inclusion which it not looking for the include in your file space. Try something like >RewriteEngine On RewriteCond %{HTTP_HOST} !^lyricsplayground.com$ [NC] RewriteRule ^(.*)$ http://lyricsplayground.com/$1 [R,L] in your .htaccess - please note, that this does depend on if you have subdomains / other redirects in your .htaccess. Quote
boxturt Posted October 8, 2005 Author Posted October 8, 2005 It works!! Thank you, thank you. I first put it in the htaccess file in the songs directory and got a 404 error. Then I put added it to the root htaccess file and victory was ours! It's because you are including the file by reference - the clue is in the error I'm lost here. Could you tell me how else to should/could include this? (for future reference) Thanks kindly Andy. Quote
TCH-Andy Posted October 8, 2005 Posted October 8, 2005 Hi Boxturt, I'm glad it's all sorted now Now you have that in your .htaccess it should be fine about everything in the future - apart from if you use subdomains. Basically some scripts do not like to run without the domain name, often because of "includes", as in your case, where it interprets the include to reference an invalid path. There are some alternative workrounds - but they virtually all have problems of some sort or another. Unless anyone else knows of a failsafe system. Quote
boxturt Posted October 8, 2005 Author Posted October 8, 2005 I know - if it's not one thing it's another Thanks again Quote
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.