Upgraded to 1.5.4, PHP includes no longer working

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

Upgraded to 1.5.4, PHP includes no longer working

Postby kanjigirl » 21. September 2006 21:01

I just upgraded to 1.5.4 from 1.3-something and am having some problems.

In the old release I used this code so I could use c:/webprojects/ as my base directory for all my websites in progress:

Alias /webprojects/ "C:/webprojects/"

<Directory "C:/webprojects">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

This worked fine. But now I'm using this code:

Alias /webprojects/ "C:/webprojects/"

<Directory "C:/webprojects">
Options Indexes FollowSymLinks +Includes ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>

And this works fine, pulls the files up with no problems *but* the PHP includes no longer work - not in .php files or in .html files, which I'd like to be able to use and parse the php.

I've added the .html and .htm filetypes to AddType application/x-httpd-php in xampp/apache/conf/extra/ as I found in the forum. I also tried moving one of my .php files into xampp/htdocs/ and the includes in my file are still not working. Here's what my html code looks like (and these work fine on my remote Unix host running Apache 1.5-something, as well as in the old release of Xampp):

<div id="header">
<?php include("phpincludes/header.php"); ?>
</div>
<div id="topmenu">
<?php include("phpincludes/navigation.php"); ?>
</div>

My questions are:

1) How do I get the includes working within PHP files?

2) Once that's working, how do I get HTML files to parse PHP?

Thanks!
kanjigirl
 
Posts: 2
Joined: 21. September 2006 20:47

Postby Wiedmann » 21. September 2006 21:09

Code: Select all
<div id="header">
<?php include("phpincludes/header.php"); ?>
</div>
<div id="topmenu">
<?php include("phpincludes/navigation.php"); ?>
</div>

What is your problem with this file? The name of this file?

BTW:
This is not correkt HTML (html, head, and body tags are missing).
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby kanjigirl » 21. September 2006 21:20

That wasn't the whole file - I was just showing how the include is formatted. Do you need to see the entire .html or .php file?

The problem is that PHP includes are not showing up in any .html or .php file of mine, but I can see the Xampp default status page fine. When I put *any* of my .html or .php files in xampp/htdocs/, PHP includes don't work which is very odd since (1) the Xampp default index pages are fine and (2) everything worked fine until I upgraded to 1.5.4 this morning.

I uninstalled and reinstalled 1.5.4 twice already.
kanjigirl
 
Posts: 2
Joined: 21. September 2006 20:47

Postby Wiedmann » 21. September 2006 23:27

The problem is that PHP includes are not showing up in any .html or .php file of mine,

Then use a error_reporting of E_ALL und look for error messages. Without error messages, and/or a real (complete) simple code sample which make problems, I can't really help.

but I can see the Xampp default status page fine.

XAMPP also use includes(). And there was no change in the code between the XAMPP versions. Thus there is a problem with your code (crazy lazy programing style ;-)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Geen » 27. October 2006 22:42

ok, now I got a very similar problem, I will now post my entire code, and then report my problem:

Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> - whateva - </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.Stil1 {
   color: #FFFFFF;
   font-family: Verdana, Arial, Helvetica, sans-serif;
}
body {
   background-color: #000000;
}
a:link {
   color: #FFFFFF;
   text-decoration: none;
}
a:visited {
   color: #FFFFFF;
   text-decoration: none;
}
a:hover {
   color: #999999;
   text-decoration: none;
}
a:active {
   text-decoration: none;
}
.Stil2 {font-size: 12px}
.Stil3 {font-size: 10px}
-->
</style></head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="550" height="795" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
   <tr>
      <td width="50" height="795" rowspan="8" background="images/index2_01.gif">&nbsp;</td>
      <td width="450" height="90" colspan="3" background="images/index2_02.gif">&nbsp;</td>
      <td width="50" height="795" rowspan="8" background="images/index2_03.gif">&nbsp;</td>
   </tr>
   <tr>
      <td width="450" height="144" colspan="3" background="images/love.gif">&nbsp;</td>
   </tr>
   <tr>
      <td width="450" height="25" colspan="3"<? 
   if($site==pics or $site==mixes or $site==videos)
   {
   echo "background=''";
   }
   else
   {
   echo "background='images/welcome.gif'";
   }?>></td>
   </tr>
   <tr>
      <td width="450" height="27" colspan="3">&nbsp;</td>
   </tr>
   <tr>
      <td width="450" height="29" colspan="3">&nbsp;</td>
   </tr>
   <tr>
      <td width="50" height="337">&nbsp;</td>
      <td width="350" height="337" valign="top"><? include "$site"."php" ; ?>&nbsp;</td>
      <td width="50" height="337">&nbsp;</td>
   </tr>
   <tr>
      <td colspan="3"><table width="100%" height="45" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="33%" height="45"><table width="100%" height="47" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="31%">&nbsp;</td>
                <td width="41%"><? 
   if($site==pics)
   {
   echo "<a href='index.php?site=pics'><img src='images/picsk.gif' border='0'></a>";
   }
   else
   {
   echo "<a href='index.php?site=pics'><img src='images/pics.gif' border='0'></a>";
   }?></td>
                <td width="28%">&nbsp;</td>
              </tr>
            </table></td>
            <td width="33%"><table width="100%" height="44" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="26%">&nbsp;</td>
                <td width="48%"><? 
   if($site==mixes)
   {
   echo "<a href='index.php?site=mixes'><img src='images/mixesk.gif' border='0'></a>";
   }
   else
   {
   echo "<a href='index.php?site=mixes'><img src='images/mixes.gif' border='0'></a>";
   }?></td>
                <td width="26%">&nbsp;</td>
              </tr>
            </table></td>
            <td width="34%"><table width="100%" height="46" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="23%">&nbsp;</td>
                <td width="52%"><? 
   if($site==videos)
   {
   echo "<a href='index.php?site=videos'><img src='images/videosk.gif' border='0'></a>";
   }
   else
   {
   echo "<a href='index.php?site=videos'><img src='images/videos.gif' border='0'></a>";
   }?></td>
                <td width="25%">&nbsp;</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
   </tr>
   <tr>
      <td width="450" height="92" colspan="3" background="images/index2_12.gif">&nbsp;</td>
   </tr>
</table>
</body>
</html>


ok, now when loading "http://localhost/folder/index.php?site=news"
i get the following error message:
Code: Select all
  Warning: include(php) [function.include]: failed to open stream: No such file or directory in D:\Programme\xampp\xampp\htdocs\folder\index.php on line 63

Warning: include() [function.include]: Failed opening 'php' for inclusion (include_path='.;D:\Programme\xampp\xampp\php\pear\') in D:\Programme\xampp\xampp\htdocs\folder\index.php on line 63
 


the funny thing is, that when i upload my page to the server of my brother and then look at it, everything works fine, but locally and on my server (hostfactory.ch) it dosn't seem to work, how can that be??
I think it must have to do something with the include path, but i just cant find out what, I tried several different settings in the .ini file, like adding ";xampp\folder\" to the include path and so on and I tried different include "versions", like include "$site.php" , include "$news.php" but the error is always the same.

also it doesn't show me different pictures when i'm on different sites (like for example on index.php?site=pics), but 1. I thnik i wrote that down that way and 2. it works on the server of my brother... :?:

please help me, i have no idea what I shall do...

btw, I use the new xampp (1.5.4a) downloaded today (27.10.2006)

Thanks,
Geen
Geen
 
Posts: 2
Joined: 27. October 2006 22:12

Postby Izzy » 27. October 2006 23:15

Not sure if this is your problem.

You have a double xampp directory structure:
D:\Programme\xampp\xampp\htdocs\folder\index.php


Did you run the xampp\setup-xampp.bat after installing. This batch file sets your non default XAMPP directory structure throughout the XAMPP installation.

http://community.apachefriends.org/f/viewtopi ... 7986#87986
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby Wiedmann » 28. October 2006 00:11

Code: Select all
<? include "$site"."php" ; ?>

Warning: include(php) [function.include]: failed to open stream: No such file or directory in ...

You don't set a value to the variable "$site" in your script. Thus PHP tries to include the file "php". And of course, a file with the name "php" does not exists and you get this error message.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Geen » 28. October 2006 15:10

I dont think that the double xampp is a problem, the xampp default site is working, and as i read before, it also uses include functions...

but the variable thing,
1. what do I have to add to the script in order that it will work and
2. why does it work on the server of my bro??
3. when I explicitly included "$news.php" it still didn't find it, meaning it gave me the same error
4. the display of different pics on different sites, like I defined in the lower part of the script, doesn't work either, its like it doesnt recognise when its which page... ??

could it be something in the include path, is it looking in the wrong folders??
But then again, why the hell did it work on my bros server? I just dont get it...

btw, thanks for your help guys!!

falls was nicht klar ist, ich kanns auf deutsch wiederholen, oder einfach dt antworten, kein problem..

geen
Geen
 
Posts: 2
Joined: 27. October 2006 22:12

Postby Wiedmann » 28. October 2006 16:42

1. what do I have to add to the script in order that it will work

Well, in the HTML part you have some links like:
Code: Select all
echo "<a href='index.php?site=pics'><img src='images/picsk.gif' border='0'></a>";

To access the value "site" of this link in your script, you must use the correct GET-Array. In this case: $_GET['site']. (and not only $site)

Code: Select all
<? include "$site"."php" ; ?>

In this line you have a second error. The variable value "pics" + "php" result in "picsphp". But IMHO you want have "pics.php" (with a dot)?

And all together:
Code: Select all
<?php include $_GET['site'].".php"; ?>


You should read the PHP manual about "external variables" (and of course the other chapters about PHP basics ;-) )

Another hint: Set your error_reporting to E_ALL.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to XAMPP for Windows

Who is online

Users browsing this forum: JJ_Tagy and 70 guests