PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 11th, 2000, 06:31 AM
andy collins andy collins is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 4 andy collins User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi Folks,

Sorry if this is a bit remedial but I'd like to know if Apache (under Linux) can be made to pass PHP code over to PHP from within .html file rather that .php.

I've tried putting php tags in my .html pages but they get sent straight through to the browser. Is this correct?


Thanks.

Andy

Reply With Quote
  #2  
Old April 11th, 2000, 02:55 PM
aarongb aarongb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Posts: 60 aarongb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
You can set mime type in httpd.conf to read .html or .htm files as php files, and then all html files will have to be interpreted through php. Why can't you just name your files .php, .php3, .php4, or .phtml?

This is how my httpd.conf reads where it refers to different versions of php. You would just add .htm or .html to the correct line. NOTE using this on Win32 does not allow you to use both php3 and php4 as it does on *nixes.

AddType application/x-httpd-php3 .phtml
AddType application/x-httpd-php3-source .phps
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php4 .php4 .php .htm .html <==like here

Reply With Quote
  #3  
Old April 12th, 2000, 02:57 AM
andy collins andy collins is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 4 andy collins User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by aarongb:
You can set mime type in httpd.conf to read .html or .htm files as php files, and then all html files will have to be interpreted through php. Why can't you just name your files .php, .php3, .php4, or .phtml?

[/quote]

Thanks for that. I'll gve it a try. I want to do it that way for a couple of reasons.
Firstly, I'm playing with the idea of using PHP to build my site on my local Linux box but then using wget to to produce a copy of my site as pure HTML as my ISP doesn't have PHP. This gives me some of the advantages of PHP without the server side processing.

The second reason is that I want my first page, the one the browser picks up without being told, (index.html) to be PHP.


Cheers..

Andy

Reply With Quote
  #4  
Old April 14th, 2000, 01:54 PM
Darguz Darguz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 1999
Location: Ann Arbor, MI USA
Posts: 6 Darguz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 29 sec
Reputation Power: 0
You can also do this in .htaccess if you only want some .html files passed to PHP.

Reply With Quote
  #5  
Old April 14th, 2000, 07:47 PM
emaz emaz is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 1 emaz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>The second reason is that I want my first
>page, the one the browser picks up without
>being told, (index.html) to be PHP.

The cleaner way:
1. have access to Apache configuration file (in my case: /etc/httpd/conf/srm.conf)
2. locate the line starting with DirectoryIndex
3. change the above line adding " index.php3" (w/o double quotes) at the end (mine reads "DirectoryIndex index.html index.htm index.shtml index.cgi index.php3 index.wml" -- again w/o quotes)
4. in your starting web directory, be sure you have your index.php3 file and you deleted index.html file

that's all

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Can Apache fire up PHP in .html pages

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap