include file with embedded include that's not being included

Problems with the Windows version of XAMPP, questions, comments, and anything related.

include file with embedded include that's not being included

Postby ChipW » 14. June 2015 22:16

yesterday I installed the latest XAMPP and ftp'd my existing web site into the htdocs directory. And imported the mysql database and tables. Everything seems to have gone successfully. I installed it on a Win7Pro laptop, just for offline development purposes.

When I look at my website on the local version, localhost/index.php, that page loads and includes the header.inc/footer.inc and body.inc files just fine. The body.inc file has two include files in it, menu.inc and recent_list.php, but they are not being included. There are no error messages and no error info in the log files. The menu.inc and recent_list.php files are simply ignored. They do exist in the root htdocs folder.

They are included just fine on the live site, on the webserver.

So, what other info do you need to troubleshoot this? Or, what am I missing in the config files? Surely there must be something I need to change since the live site works just fine.

Thanks
ChipW
 
Posts: 4
Joined: 14. June 2015 21:47
Operating System: Win7 Pro

Re: include file with embedded include that's not being incl

Postby Nobbie » 15. June 2015 13:17

Show us some code please.
Nobbie
 
Posts: 8770
Joined: 09. March 2008 13:04

Re: include file with embedded include that's not being incl

Postby ChipW » 15. June 2015 17:07

Ok, just a reminder, the website is a live site on a live server and everything works properly. I installed xampp on my laptop, ftp'd the live site into the htdocs folder on the laptop, and the two included files in the body.inc file (second code below) are not being included when the pages load. It's not a browser issue, and there are no messages of any kind in the logs, in regards to the include files, and no error messages of any kind, period. The live site is running on a linux box, my laptop is running win7pro. The xampp install is completely default. The purpose of the local, laptop, installation is simply for development of the site, offline, so this is no game-breaker, but it is irritating, to say the least.

the code below is the index.php file
Code: Select all
<?php

include("db_connect.inc");

include("header.inc");

include("body.inc");

   // setup SQL statement
   $result = mysql_query("SELECT body, description, blog_page FROM `blogs` WHERE id=(select max(id) from blogs)") or die(mysql_error());
   
  //execute SQL statement
  $row = mysql_fetch_array( $result );
   
   // check for errors
   if (!$result) { echo( mysql_error()); }
   else {

      // display results
      echo $row['body'];
   }
   
//include("comment_box.inc");
include("footer.inc");
?>


And the following is the body.inc file -
Code: Select all
<body>
    <p><script type="text/javascript">
// <![CDATA[
    function popup(mylink, windowname)
        {
        if (! window.focus)return true;
        var href;
        if (typeof(mylink) == 'string')
        href=mylink;
        else
        href=mylink.href;
        window.open(href, windowname, 'width=600,height=200,scrollbars=yes');
        return false;
        }
    // ]]>
    </script></p>
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div id="main">
<div id="header">
<div id="logo">
<div id="logo_text">
<!-- class="logo_colour", allows you to change the colour of the text -->
<h1><a href="index.php">Chip<span class=
"logo_colour">Wiegand</span></a></h1>
</div>
</div>
<? include("menu.inc"); ?>
<div id="site_content">
    <div class="sidebar"><!-- insert sidebar items here -->
        <img src="images/Chip%204-30-2011%202.JPG" alt="Chip Wiegand"
        width="190" height="144" border="0">
        <div class="fb-follow" data-href="https://www.facebook.com/chip.wiegand.colombia" data-colorscheme="light" data-layout="button" data-show-faces="false"></div>
        <a href="http://co.linkedin.com/pub/chip-wiegand/83/ab6/a35/"><img src="images/logo_linkedin_56x14.png" alt="LinkedIn" border="0" /></a>
        <a onclick="return popup(this, 'notes')" href="http://wiegand.org/wu_transfer_info.html"><img src="images/western_union_logo.jpg" alt="Chip Wiegand" width="150" height="50" border="0"><a onclick="return popup(this, 'notes')" href="http://wiegand.org/wu_transfer_info.html"></a>
        <a href="https://www.crowdrise.com/Chipwiegand"><img src="images/crowdrise-logo.png" alt="Crowdrise" width="150" height="50" border="0" /></a>
        <?
        include("recent_list.php");
        ?>
        <br>
        <p><a href="http://info.flagcounter.com/94Ki"><img src="http://s10.flagcounter.com/count/94Ki/bg_FFFFFF/txt_000000/border_FFFFFF/columns_2/maxflags_50/viewers_0/labels_1/pageviews_0/flags_0/" alt="Free counters!" border="0"></a></p>
    </div>
ChipW
 
Posts: 4
Joined: 14. June 2015 21:47
Operating System: Win7 Pro

Re: include file with embedded include that's not being incl

Postby mark.mcdonald » 15. June 2015 17:36

My guess is either the operating systems handle the code differently and may need some minor code tweaking from linux to windows. like adding .php to your files or <?php at the beginning vs <? (this is a difference between your index and inc file)
A folder such as inc (short for includes):

<?php @include(" ./inc/header.inc.php "); ?>
The @ suppresses errors. Leave off during testing. Remember to remove spaces in the include line.

If you will be using the includes inside folders, replace the line above with this:
<?php @include( $_SERVER[" DOCUMENT_ROOT" )." /inc/header.inc.php "); ?>
mark.mcdonald
 
Posts: 160
Joined: 13. March 2015 15:48
Location: Edmonton
Operating System: Windows Server 2012 R2

Re: include file with embedded include that's not being incl

Postby ChipW » 15. June 2015 18:36

Thanks for the tips. The problem is this: on win7 I have to use ' <?php ' while on linux it works fine with ' <? '. I have now fixed those tags in all my files and the site works fine on the laptop.
Thanks for the tips.
ChipW
 
Posts: 4
Joined: 14. June 2015 21:47
Operating System: Win7 Pro

Re: include file with embedded include that's not being incl

Postby glitzi85 » 15. June 2015 18:46

User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Re: include file with embedded include that's not being incl

Postby Nobbie » 15. June 2015 19:26

ChipW wrote:Thanks for the tips. The problem is this: on win7 I have to use ' <?php ' while on linux it works fine with ' <? '. I have now fixed those tags in all my files and the site works fine on the laptop.
Thanks for the tips.


That is not a question of Windows or Linux. but a question of php.ini, whether "short_tags" is enabled or not. But "short_tags" wont be supported in PHP 6 anymore.
Nobbie
 
Posts: 8770
Joined: 09. March 2008 13:04

Re: include file with embedded include that's not being incl

Postby ChipW » 15. June 2015 19:43

Good to know, thanks. I've updated all my files to <?php so that shouldn't be a problem in the future.
ChipW
 
Posts: 4
Joined: 14. June 2015 21:47
Operating System: Win7 Pro

Re: include file with embedded include that's not being incl

Postby Altrea » 15. June 2015 20:22

Nobbie wrote:But "short_tags" wont be supported in PHP 6 anymore.

Source?
php.net don't say anything about that exept that ASP like tags (<% %>) are no longer supported with PHP 7.

http://php.net/manual/en/language.basic ... hptags.php
http://php.net/manual/en/ini.core.php#i ... t-open-tag

btw: PHP 6 will never get released, the next major version of PHP will be PHP 7.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8293
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 49 guests