Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: php in the HEADER and README.html |
|
Author |
|
Bobscrachy
Joined: 13 Feb 2006 Posts: 39 Location: Texas
|
Posted: Sun 16 Dec '07 20:28 Post subject: php in the HEADER and README.html |
|
|
How do I set the HEADER and README.html to be read through the php engine? |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Sun 16 Dec '07 23:46 Post subject: |
|
|
Since PHP must be of type application/x-httpd-php
and the header and readme files must be of type text/html
I find the simplest way is using SSI
Apache Config:
<Directory "c:/some/directory/to/index/">
Options Indexes Includes
..
..
AddOutputFilter Includes html
</Directory>
Create the PHP file/s seperately, let's name it HEADER.php
now in HEADER.html .. just one line
<!--#include file="HEADER.php" -->
The below example will just detect browser and echo remote_host
http://indexexample.justmyspace.org/
Edit:
I forgot to mention that mod_includes needs to be loaded. Also note the above example uses IndexIgnore to ignore indexing the stylesheet and the images folder and uses IndexOptions, specifically "+SuppressHTMLPreamble" to get rid of the
"Index of /" heading.
Gregg
Last edited by glsmith on Mon 17 Dec '07 9:10; edited 1 time in total |
|
Back to top |
|
Bobscrachy
Joined: 13 Feb 2006 Posts: 39 Location: Texas
|
Posted: Mon 17 Dec '07 0:57 Post subject: |
|
|
Code: | <Directory "c:/Apache2/htdocs">
Options Indexes Includes
AddOutputFilter Includes shtml
</Directory> |
I put this in my apache config and the server crashed. I read the apache SSI pages and tried changing it to.
Code: |
<Directory "c:/Apache/Apache2/htdocs">
Options +Includes
AddOutputFilter Includes html
</Directory> |
I substituted that for this. This though I put into a htaccess file.
Code: |
AddType text/html .shtml
AddHandler server-parsed .shtml
Options Indexes FollowSymLinks Includes |
and got this
Code: | [an error occurred while processing this directive] |
I still haven't had any luck getting anything but a 500 or that error message. |
|
Back to top |
|
Bobscrachy
Joined: 13 Feb 2006 Posts: 39 Location: Texas
|
Posted: Mon 17 Dec '07 3:38 Post subject: |
|
|
Figured it out. I had a bad path to the php file I was trying to host. This htaccess code did the trick.
Code: |
AddType text/html .shtml
AddHandler server-parsed .shtml
Options Indexes FollowSymLinks Includes |
I had incorporated SESSIONS code in my php script, but i guess the server doesn't keep track of which session it is when its being served. Do you know why it does that. |
|
Back to top |
|
|
|
|
|
|