homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Gold Sponsor 2015!
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

saving file as PHP?
PHP file save

5+ Year Member

Msg#: 4410468 posted 11:32 pm on Jan 24, 2012 (gmt 0)

This is going to sound dumb as I am a total noob.
Do I have to save a page with PHP on it as a .php file. I have html pages and am wondering is there a way to make PHP work on a .html extension page? Or do I always have to save it as .php

What about .html.php?




WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Msg#: 4410468 posted 11:42 pm on Jan 24, 2012 (gmt 0)

There's several ways to fix this.

One is to save your PHP scripts with filenames ending in .html and use either the AddType or AddHandler directive in .htaccess to tell your server that these files can also have PHP code in them.

The other way is to save the files as .php files and the server will know what to do with them, but in order to continue using .html URLs you will need to add a simple rewrite to the site configuration so that when .html URLs are requested, the server will use the matching .php file to deliver the content.

URLs and files are not at all the same thing. They are merely related by the action of a server in responding to URL requests. You can alter this action by changing the server configuration.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved