Include Files
Moderator: General Moderators
Include Files
I am moving to a new server and I'm having issues with some include files. The files reside in my root web in a folder called includes (they are header and footer files). The files have the extension .inc. After to moving to the new server these work fine for locally stored files but when I call these include files from another server I get the following error:
Warning: include(http://freemanweb11.freeman.tulane.edu/ ... header.inc) [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\web\webdocs\wp-content\themes\freeman\header.php on line 39
Warning: include() [function.include]: Failed opening 'http://freemanweb11.freeman.tulane.edu/ ... header.inc' for inclusion (include_path='.;C:\php5\pear') in C:\web\webdocs\wp-content\themes\freeman\header.php on line 39
In php.ini both allow_url_fopen and allow_url_includes are set to "on". The is the same set up as on the old server where everything works fine. Oddly enough if I name the include files with an extension of .php they work fine. Can anyone point me in the right direction? My brain is wracked! Thanks in advance for any assistance.
Alicia
ETA: Another oddity, the error references c:\php5\pear. This folder does not exist when I check the phpinfo the configuration file loaded for all servers is what I expect it to be. When I installed php I installed in a folder on the root of c called "php" there is no php5 folder. I can't determine where this is coming from.
Warning: include(http://freemanweb11.freeman.tulane.edu/ ... header.inc) [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\web\webdocs\wp-content\themes\freeman\header.php on line 39
Warning: include() [function.include]: Failed opening 'http://freemanweb11.freeman.tulane.edu/ ... header.inc' for inclusion (include_path='.;C:\php5\pear') in C:\web\webdocs\wp-content\themes\freeman\header.php on line 39
In php.ini both allow_url_fopen and allow_url_includes are set to "on". The is the same set up as on the old server where everything works fine. Oddly enough if I name the include files with an extension of .php they work fine. Can anyone point me in the right direction? My brain is wracked! Thanks in advance for any assistance.
Alicia
ETA: Another oddity, the error references c:\php5\pear. This folder does not exist when I check the phpinfo the configuration file loaded for all servers is what I expect it to be. When I installed php I installed in a folder on the root of c called "php" there is no php5 folder. I can't determine where this is coming from.
Re: Include Files
...Maybe this is too obvious, but have you tried loading http://freemanweb11.freeman.tulane.edu/ ... header.inc in a web browser? If you can't get it there, you won't get it through include() either.aliciadg wrote:...but when I call these include files from another server I get the following error:
Warning: include(http://freemanweb11.freeman.tulane.edu/ ... header.inc) [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\web\webdocs\wp-content\themes\freeman\header.php on line 39
Warning: include() [function.include]: Failed opening 'http://freemanweb11.freeman.tulane.edu/ ... header.inc' for inclusion (include_path='.;C:\php5\pear') in C:\web\webdocs\wp-content\themes\freeman\header.php on line 39
Re: Include Files
Yes, I tried this and I get a 404. However in this same folder I have been able to access .html and .php files. It's almost as if I need to tell something somewhere how to respond to a .inc or a .include file type.......Maybe this is too obvious, but have you tried loading http://freemanweb11.freeman.tulane.edu/ ... header.inc in a web browser? If you can't get it there, you won't get it through include() either.
ETA: I have double checked permissions on this folder as well.
Re: Include Files
Don't try to access your own files (on the same server or another) over HTTP like that. It's silly. It means more bandwidth, more costs, slower loading time...
If you like those includes and want to use them then copy the files over to your server and include them from there.
If you like those includes and want to use them then copy the files over to your server and include them from there.
Re: Include Files
@aliciadg: including a url is the equivalent of loading it in a browser and grabbing the contents.
@tasairis: Correct.
There's always a possibility there's a good reason to include from another server, though.
@tasairis: Correct.
Re: Include Files
It's not really all that silly in my current environment, and is necessary in order for my users to properly maintain the site. I am dealing with over 25 users and over 50,000 files on 4 servers. Please address my issue of the include files if you have any helpful info.tasairis wrote:Don't try to access your own files (on the same server or another) over HTTP like that. It's silly. It means more bandwidth, more costs, slower loading time...
If you like those includes and want to use them then copy the files over to your server and include them from there.
Re: Include Files
Understood, does anyone have any input on why this might be happening?Skara wrote:@aliciadg: including a url is the equivalent of loading it in a browser and grabbing the contents.
@tasairis: Correct.There's always a possibility there's a good reason to include from another server, though.
Re: Include Files
As I've stated before, the reason lies not in your code but in this server not being online:
http://freemanweb11.freeman.tulane.edu/
http://freemanweb11.freeman.tulane.edu/
Re: Include Files
It is online, it is not visible to those outside of the domain, but the server and the other server calling the include files are both online inside the same domain. My apologies for not being clear on that. As I stated before in my original post if I change the file extension from .inc to .php and I call the .php file as the include file it works.
Re: Include Files
AH, sorry.. ^^;It is online, it is not visible to those outside of the domain
... ^ do that.if I change the file extension from .inc to .php and I call the .php file as the include file it works
Re: Include Files
Okay, so I added it to the configuration and now it's working. It is so odd, though, the .inc files were being called by files stored locally and they were working, this was only an issue when using the full url path from another server to call the .inc files....
Bahhhh! Anyway, thanks for talking me through this, it's very helpful sometimes to just discuss it! I was literally losing my mind!
Bahhhh! Anyway, thanks for talking me through this, it's very helpful sometimes to just discuss it! I was literally losing my mind!
Re: Include Files
That is weird it would only break then. Anyway, glad you got it working.
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: Include Files
A suggestion...since it's best to run a copy of a site locally (or over a network server if you're at work in example)I highly recommend having a path(ing) system. That way you can ensure your work will work with minimal effort...if you change something you would only have to point in one place or another.
...I do the same thing with my site's XHTML base element...
...and in the $cms class I do pretty much the same thing as in my first chunk of code above to determine where everything should be located.
I also recommend looking at WHAT the current path is set versus where it's trying to include...
dir_1/dir_2/dir_3/dir_a/dir_b/
dir_1/dir_2/dir_3/dir_c/dir_d/
...find the difference and work from that.
Code: Select all
<?php
if ($_SERVER['HTTP_HOST'] == "www.mydomain.com") {$truedbuser = "mycom";}
else if ($_SERVER['HTTP_HOST'] == "www.mydomain.net") {$truedbuser = "mynet";}
else if ($_SERVER['HTTP_HOST'] == "localhost") {$truedbuser = "jab";}
?>Code: Select all
<?php
echo '<base href="'.$cms->base1.$cms->base2.'" />' . "\n";
?>I also recommend looking at WHAT the current path is set versus where it's trying to include...
dir_1/dir_2/dir_3/dir_a/dir_b/
dir_1/dir_2/dir_3/dir_c/dir_d/
...find the difference and work from that.