solved: SSI Doesn't Work Correctly or At All

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

solved: SSI Doesn't Work Correctly or At All

Postby CPcoder » 16. February 2006 09:12

On a test page, I have a combination of a few ways to use PHP:
  1. embedded PHP: <?php echo "Hi again!"; ?>
  2. SSI in HTML-comment style: <!--#echo var="DATE_LOCAL" -->
  3. SSI in HTML-comment style to include the results of running a script: <!--#include virtual="/myPHP/hello.php" -->


At first, just the embedded PHP was working (the default upon installation).
Then, I added "Option +Includes" and also filters, after which everything was working except the script results were not being returned. I had the HTML page saved with extension ".phtml".

There is no problem with the script, because it worked under a traditional Apache installation. (I actually couldn't get embedded PHP to work under a traditional installation and decided to try XAMPP.)

But, once I added ".shtml" to my filters, nothing works, not even embedded PHP. I even tried saving a copy of the page with each extension. I made the changes wherever I noticed filters were used in httpd.conf, not just in the default directory.

Here is an example:
<Directory />
Options FollowSymLinks +Includes
AllowOverride None
Order deny,allow
Deny from all
AddType text/html .shtml .phtml
AddOutputFilter INCLUDES .shtml .phtml
</Directory>

My XAMPP installation details are in my signature. Normal test HTML pages (both the included ones and my own in a lower folder) work fine.
Last edited by CPcoder on 24. February 2006 04:58, edited 1 time in total.
WinXP Home SP2
XAMPP 1.5.1 in top-level directory
Unzipped directly from .zip file
no other severs running
CPcoder
 
Posts: 30
Joined: 16. February 2006 08:44

Postby Wiedmann » 16. February 2006 11:39

My XAMPP installation details

Which XAMPP version? (I guess you have 1.5.1?)

embedded PHP: <?php echo "Hi again!"; ?>

What is "embedded PHP"? If you need PHP in files with an other extension as ".php" you have to change line 9 in "httpd-xampp.conf" --> "AddType ..."

SSI in HTML-comment style: <!--#echo var="DATE_LOCAL" -->

SSI in HTML-comment style to include the results of running a script: <!--#include virtual="/myPHP/hello.php" -->

If you need SSI change line 436-437 in "httpd.conf" --> remove the "#" from "AddType ..." and "AddOutputFilter ..."
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby CPcoder » 16. February 2006 16:59

Wiedmann wrote:My XAMPP installation details
Which XAMPP version? (I guess you have 1.5.1?)
Correct.

Wiedmann wrote:
embedded PHP: <?php echo "Hi again!"; ?>
What is "embedded PHP"?
A PHP tag in in HTML file, just as shown (using extensions .phtml and .shtml).

Wiedmann wrote:If you need PHP in files with an other extension as ".php" you have to change line 9 in "httpd-xampp.conf" --> "AddType ..."
I looked all through the folders and I don't see any "httpd-xamp.conf"...only "httpd.conf"

Wiedmann wrote:
SSI in HTML-comment style: <!--#echo var="DATE_LOCAL" -->

SSI in HTML-comment style to include the results of running a script: <!--#include virtual="/myPHP/hello.php" -->

If you need SSI change line 436-437 in "httpd.conf" --> remove the "#" from "AddType ..." and "AddOutputFilter ..."
I did that in every place that seemed appropriate, including where you're talking about (the line #s don't exactly match because I added comments w/a keyword wherever I changed things so I can easily find them):
  • AddType text/html .shtml .phtml
  • AddOutputFilter INCLUDES .shtml .phtml
WinXP Home SP2
XAMPP 1.5.1 in top-level directory
Unzipped directly from .zip file
no other severs running
CPcoder
 
Posts: 30
Joined: 16. February 2006 08:44

Postby CPcoder » 16. February 2006 17:07

How About if I overwrite "httpd.conf" with "oldhttpd.conf" and start over? See what doesn't work at the beginning (not sure I remembered that exactly right before), see what works when I uncomment those "AddType" and "AddOutputFilter" lines, without adding any lines myself.


Okay, this is retarded....I just deleted "httpd.conf" and opened "oldhttpd.conf" and saved it as "httpd.conf" (so I have 2 same configuration files under each name, just like when you first install it)...now localhost is not working at all. I even re-started my computer, started up XAMPP control, and started the Apache server from it, which is the way I've been starting it all along (not installing it as a service).

The default setup is supposed to run "out of the box", and it was before...this makes no sense. Has anyone else had this happen?

I have to go to work, I'll come back later.
WinXP Home SP2
XAMPP 1.5.1 in top-level directory
Unzipped directly from .zip file
no other severs running
CPcoder
 
Posts: 30
Joined: 16. February 2006 08:44

Postby Wiedmann » 16. February 2006 18:29

looked all through the folders and I don't see any "httpd-xamp.conf"...only "httpd.conf"

IMHO Windows have a really good find-file-funktion...

This file is in "\xampp\apache\conf\extra".

I did that in every place that seemed appropriate, including where you're talking about

I mean the lines inside the "<IfModule mime_module> ... </IfModule>" - Directives.

(the line #s don't exactly match because I added comments w/a keyword wherever I changed things so I can easily find them):

You can extract the originals files from the archiv (or your backup copy) to see which lines I mean.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby CPcoder » 17. February 2006 06:16

Sorry, my eyes were kinda tired and I had to leave for work, didn't have time to do a search.

This is what I did now. I went to the directory where I saved the original zip file, browsed it with 7-zip, and extracted just httpd.conf to my xampp/apache/conf directory. The only changes I made were below, and I followed along through the Apache 2.0 docs regarding related directives and modules to make sure I wasn't missing anything. With the exception of my email addy, these are the ONLY things I changed!


xampp/apache/conf/httpd.conf
LINE 216:
Code: Select all
<Directory "/xampp/htdocs">
    ...
    Options Indexes FollowSymLinks Includes ExecCGI


LINES 436 & 437:
Code: Select all
<IfModule mime_module>
    ...
    AddType text/html .shtml .phtml
    AddOutputFilter INCLUDES .shtml .phtml



xampp/apache/conf/extra/httpd-xampp.conf
LINE 10:
Code: Select all
<IfModule mime_module>
    ...
   # MYCHANGE: ADDED .shtml TO AddType SO PHP CAN BE INCLUDED IN IT
    AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml .shtml



My .phtml or .shtml file will show the result of an embedded php statement <?php echo "Hi again!"; ?>, and the results of any SSI directives such as <!--#echo var="DATE_LOCAL" -->, but NOTthe results of a PHP script such as <!--#include virtual="/myPHP/hello.php" -->.

Instead, where the results of running the script should be, it says:
[an error occurred while processing this directive]


I wonder if there needs to be some sort of "shebang line" in PHP as in Perl? This script (and a more complicated one, as well) worked under the download from Apache.org, but neither is working under XAMPP. Is XAMPP different in this way?
WinXP Home SP2
XAMPP 1.5.1 in top-level directory
Unzipped directly from .zip file
no other severs running
CPcoder
 
Posts: 30
Joined: 16. February 2006 08:44

Postby CPcoder » 17. February 2006 06:43

I THINK MAYBE IT'S A WINDOWS PROBLEM OR A MEMORY LEAK...

...not that I really know what a memory leak is, but here's why. I got the alert "Apache has encountered an error and needs to close". When it sounded like the disk stopped churning, XAMPP Control showed that it was still running, I don't know if it was confused or if Windows really wasn't able to stop Apache (that would shock me). So I clicked the "Stop" button. After it showed that Apache stopped, I restarted it. My .shtml page worked fine including the results of the script. However, I couldn't check the .phtml page because Windows foiled me again! I assume it's fine. BTW, it's a simple script, just another version of "Hello, world".

TO SUM UP:
  1. I did remember to stop and start Apache with XAMPP Control after making the changes (SEE PREVIOUS POST).
  2. SSI would NOT show output of a script in an .shtml or .phtml page.
  3. Windows problem shut Apache down.
  4. XAMPP Control showed Apache still running after disk stopped churning, so I clicked "Stop" there, then "Start".
  5. The page I was able to view now shows the output of the script.
  6. Windows shuts Apache down again (and keeps doing it).


There is mention in the Apache docs that setting "MaxRequestsPerChild" can be useful to guard against memory leaks taking over all your memory, and right now it is set to "0" (UNLIMITED), the default. Maybe I should set it...what would be a good value? (This is not a production server, but I have a tendency to view pages multiple times in my browser...Firefox, except for fine-tuning CSS) while editing. Do you think this could be a memory-leak problem causing random errors?
WinXP Home SP2
XAMPP 1.5.1 in top-level directory
Unzipped directly from .zip file
no other severs running
CPcoder
 
Posts: 30
Joined: 16. February 2006 08:44

Postby Captain Kidd » 18. February 2006 05:20

I'm having a similar issue. I just upgraded from 1.4.something to 1.5.1. With 1.4 my SSIs were working fine. Now nada.

I've done as directed earlier in the thread and removed the #'s on lines 436 & 437. That switched the SSI status to activated, but I'm still not getting my includes to work.

My .htaccess had been using:
Code: Select all
Options +Includes
AddType text/html .shtml
AddHandler server-parsed .shtml

After looking through the Apache SSI documentation I changed it to:
Code: Select all
Options +Includes
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

I'm at a loss as to what to do next.

Edit: I uninstalled 1.5.1 and installed 1.4.16. Now they work again.
Captain Kidd
 
Posts: 4
Joined: 19. November 2005 21:00

Postby Wiedmann » 18. February 2006 13:36

I've done as directed earlier in the thread and removed the #'s on lines 436 & 437. That switched the SSI status to activated, but I'm still not getting my includes to work.

You have a small example (with exact paths) to verify the problem?

(after removing the two "#" SSI is working correkt on my box in short test)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Captain Kidd » 19. February 2006 21:13

It's working now. Weird, I had reboot the computer and the status page showed SSIs activated but it wouldn't include. At that point I made my post. I then used the Xampp control panel to stop Apache and start t up again and SSIs started working.
Captain Kidd
 
Posts: 4
Joined: 19. November 2005 21:00

Postby CPcoder » 23. February 2006 00:01

Captain Kidd wrote:It's working now. Weird, I had reboot the computer and the status page showed SSIs activated but it wouldn't include. At that point I made my post. I then used the Xampp control panel to stop Apache and start t up again and SSIs started working.
That is exactly what happened to me. Do you also now sometimes have Windows telling you that Apache will close? That is what is happening to me now.
WinXP Home SP2
XAMPP 1.5.1 in top-level directory
Unzipped directly from .zip file
no other severs running
CPcoder
 
Posts: 30
Joined: 16. February 2006 08:44

Postby Captain Kidd » 25. February 2006 03:31

No, it's all hunky-dory now.
Captain Kidd
 
Posts: 4
Joined: 19. November 2005 21:00

Postby CPcoder » 25. February 2006 08:57

I'm glad you worked your issues out. I may have to "downgrade" to XAMPP 1.44. We'll see.
WinXP Home SP2
XAMPP 1.5.1 in top-level directory
Unzipped directly from .zip file
no other severs running
CPcoder
 
Posts: 30
Joined: 16. February 2006 08:44


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 58 guests