Page 1 of 1

Require/Include not working

PostPosted: 09. December 2009 07:26
by Bill Smith
I just installed XAMPP 1.7.2. It seems to be working fine overall, but I am having one problem.

I created a folder inside the HTDOCS folder, and then used my browser to go to the index.php page (using "http://localhost/PolkaDotKids/index.php", which displayed the page fine. But when I click on one of the links, the php code displays an IFRAME correctly (and the IFRAME php code works correctly) - but the page header and page end code is not displayed. The php line which doesn't seem to work is "<? Require "inc/header.php" ?>".

I can upload these same pages to my host server, and they work correctly. But I would like to get this to work on my local PC as well. I am running XP.

Thanks for any help anyone is able to offer. Hopefully I just need to tweak some portion of my install.

Re: Require/Include not working

PostPosted: 09. December 2009 08:14
by Wiedmann
Code: Select all
<?

Code: Select all
<?php

Re: Require/Include not working

PostPosted: 09. December 2009 19:58
by Bill Smith
Thank you for your fast reply.

That did the trick. It works fine now.

Apparently, the windows version has less tolerance then the version running on my hosting service.

Re: Require/Include not working

PostPosted: 10. December 2009 01:13
by Izzy
Bill Smith wrote:Apparently, the windows version has less tolerance then the version running on my hosting service.
Not really a true case of tolerance but more a case of how differently server's can be configured to suit certain conditions.

XAMPP developers tend to configure the included components to be as near to the safest defaults as possible and to heed the component author's warnings about issues that may arise if certain settings are used.

Where as your hosting service may configure their server's to suit there own lower support request needs and for backward computability - eventually they may also have to configure their server's differently if they get too many support requests from people using more up to date methods like XML etc.

Also of course your hosting service may not yet be using PHP 5.3 - which is the PHP version in use in XAMPP 1.7.2

PHP in XAMPP is configured using the \xampp\php\php.ini file and what you used in your code was the short_open_tag directive which may cause conflicts and confusion for Apache when using other scripts, as described in the configuration comments of short_open_tag at about line 214 in php.ini file of version XAMPP 1.7.2.

Please check out the php.ini section related to the short_open_tag directive and the associated comments, which by default in XAMPP is set to Off, hence the reason for the issue you described above.

If you still wish to use <? instead of <?php then simply use shorts_open_tag = On in the php.ini file, save it and then restart Apache.

BTW, XAMPP versions prior to 1.7.2 used the short_open_tag = On setting and so this issue you had would not have been evident.

Re: Require/Include not working

PostPosted: 10. December 2009 01:45
by Bill Smith
Thanks Izzy,

I went into the php.ini file and found the entry you mentioned.

I appreciate your explaination.

Bill