Forum Moderators: coopster

Message Too Old, No Replies

Server will not use include()

Windows 2003 / PHP server will not use includes

         

killerkamel

10:59 pm on Aug 17, 2008 (gmt 0)

10+ Year Member



Configuration:
Win 2003 Server
PHP 5.2.6
IIS 6.0
IIS using ISAPI to run PHP.

Problem:

<?
include ('something.php');
?>

No include files will load.
There are no errors being displayed on the page.
No errors in the server log.
This is a new install of PHP on Windows, so is the include function found in an /ext dll?

The content of the include file simply does not show up.

This site was originally built on Linux/Apache/PHP config. it worked fine.
I do not have access to that servers php.ini file to compare settings.

Any ideas?

encyclo

12:09 am on Aug 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld. :) PHP probably isn't configured to accept the shorthand
<?
- try this:

<?[b]php[/b]
include ('something.php');
?>

StoutFiles

1:29 am on Aug 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know why anyone uses the shorthand <?...they shouldn't even show it as an option in tutorials. <?php is like wearing your seatbelt while driving.

killerkamel

4:10 am on Aug 18, 2008 (gmt 0)

10+ Year Member



No luck there! I made the changes you suggested to no avail.

I have plenty of code around the site, it's just the includes that do not show up.

While we are on the topic, what is the significance of <?php. I have written php for years, and have never had trouble that I could link to using the shorthand version.

Thanks for the effort guys, any other ideas?

StoutFiles

4:14 am on Aug 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try the require.

<?php
require('something.php');
?>

If it doesn't work like the include you should at least get an error.

killerkamel

4:32 am on Aug 18, 2008 (gmt 0)

10+ Year Member




Alright. That worked, but I don't understand why. Let me explain.

I have 4 includes on a page. This is not my code but i'll demonstrate what I did.

<?php
include ('functions.php');
include ('header.php');
include ('footer.php');
?>

I added require('functions.php'); but did not remove any of the includes. That would look something like this.

<?php
require('functions.php');
include ('functions.php');
include ('header.php');
include ('footer.php');
?>

All 3 includes began working!

So I said hmn... I'll remove the require('functions.php'); that I just added just to see what happens.

All 3 includes work now! They work across my site with the same code that I had when I wrote my first message.

killerkamel

4:34 am on Aug 18, 2008 (gmt 0)

10+ Year Member




I am power cycling and removing browser cache to see what happens.

Thank you for your help tho. I do appreciate your time.

eelixduppy

1:25 pm on Aug 18, 2008 (gmt 0)



Interesting. Not sure why that would have worked if only functions are defined in the file that was included twice, the browser shouldn't have known the difference for caching purposes. Actually, you should have been getting "cannot redeclare function" errors from the script, so maybe that is what was different.

Anyway, glad you got it working, and Welcome to WebmasterWorld! :)