LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-11-2003, 08:18 PM   #1
bmar
LQ Newbie
 
Registered: Apr 2003
Posts: 4

Rep: Reputation: 0
Question Apache2, php code parsed as *.shtml


Hi there, I am working on an old website with SSI (server side includes) all over the place, there is too much work to change the names of all the files from *.shtml to *.php to be able to parse some PHP code.

The webserver has Apache2 on it (Redhat8.0), I was told that in earlier versions of Apache it was very easy to configure httpd.conf to parse PHP (or whatever) with any extensions you prefer...

I have been looking through both httpd.conf and php.ini on the server but I can't see where I can change this :/


Thanks in advance,
bmar
 
Old 04-11-2003, 10:02 PM   #2
speedracer05
Member
 
Registered: Jul 2002
Location: San Diego
Distribution: RH 8
Posts: 33

Rep: Reputation: 15
You can parse php with a .shtml extension by adjusting the following line in your httpd.conf:

AddType application/x-httpd-php .php .shtml

Just add the ".shtml", then restart apache.
 
Old 04-12-2003, 08:04 AM   #3
bmar
LQ Newbie
 
Registered: Apr 2003
Posts: 4

Original Poster
Rep: Reputation: 0
I tried this on my Apache 1.3.22:

<IfModule mod_php4.c>
AddType application/x-httpd-php .php .php4 .php3 .phtml .shtml
AddType application/x-httpd-php-source .phps
</IfModule>

#
# For PHP/FI (PHP2), use:
#
<IfModule mod_php.c>
AddType application/x-httpd-php .phtml .shtml
</IfModule>

And restarted Apache and tried a document with <? phpinfo(); ?> and named as *.shtml but didn't work But, it works as *.phtml

Any ideas ?
 
Old 04-12-2003, 06:10 PM   #4
speedracer05
Member
 
Registered: Jul 2002
Location: San Diego
Distribution: RH 8
Posts: 33

Rep: Reputation: 15
Edited -

Just add the AddType line below <IfModule> information:

<IfModule mod_php4.c>
AddType application/x-httpd-php .php .php4 .php3 .phtml .shtml
AddType application/x-httpd-php-source .phps
</IfModule>

#
# For PHP/FI (PHP2), use:
#
<IfModule mod_php.c>
AddType application/x-httpd-php .phtml .shtml
</IfModule>

### Add the line here

AddType application/x-httpd-php .php .php4 .php3 .phtml .shtml

Now restart Apache.


Last edited by speedracer05; 04-12-2003 at 06:25 PM.
 
Old 06-29-2003, 04:46 AM   #5
robpsu
LQ Newbie
 
Registered: Jun 2003
Posts: 1

Rep: Reputation: 0
php with shtml

I figured since I was using SSI that i would just call the php file.

<!--#include file="phpfile.php" -->
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2.0.52, t1lib-5.0.2, php-apache2-5.0.2 wizard7423 Slackware 2 04-04-2011 08:09 PM
shtml on apache2 jsheffie Linux - Software 3 09-08-2005 07:56 PM
Have installed PHP for Apache2 but source code showing Tomo3000 SUSE / openSUSE 4 08-04-2005 07:14 PM
PHP or SHTML? SE optimization linuxfond Linux - Newbie 2 06-15-2004 02:40 AM
Tearing My Hair Out: PHP isnt being parsed by Apache 2!! pnh73 Linux - Software 2 01-19-2004 04:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration