PHP page - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-24-2011, 09:22 AM   #1 (permalink)
Junior Member
 
kash's Avatar
 
Join Date: Jul 2010
Location: London
Posts: 72
Default PHP page

I have a html page (with '.html' extension). Can I insert a php code to it? If I do, does the page have to be saved as '.php'?
kash is offline   Reply With Quote
Sponsored Links
Old 02-24-2011, 10:13 AM   #2 (permalink)
Junior Member
 
johneva's Avatar
 
Join Date: Nov 2010
Location: UK
Posts: 61
Default Re: PHP page

You can use PHP yes, but you will have to change your server settings to parse .html files as PHP or change your files to have the extension .php
johneva is offline   Reply With Quote
Old 02-24-2011, 01:35 PM   #3 (permalink)
Junior Member
 
Join Date: Feb 2011
Posts: 16
Default Re: PHP page

yes of course but you have to edit your settings on server.
aokiji1 is offline   Reply With Quote
Old 02-24-2011, 10:12 PM   #4 (permalink)
Regular User
 
hilhilginger's Avatar
 
Join Date: Dec 2010
Posts: 272
Default Re: PHP page

Quote:
Originally Posted by johneva View Post
You can use PHP yes, but you will have to change your server settings to parse .html files as PHP or change your files to have the extension .php
But make sure your hosting provider's server supports PHP scripts. Otherwise it is not possible even if you change the setting.you can try it check with a simple php page. test.php
PHP Code:
<html>

<head>
<title>Example #1 TDavid's Very First PHP Script ever!</title>
</head>
<? print(Date("1 F d, Y")); ?>

<body>
</body>
</html>
__________________
Unique Articles for SEO www.softnwords.com
hilhilginger is offline   Reply With Quote
Old 02-25-2011, 02:43 PM   #5 (permalink)
Junior Member
 
kash's Avatar
 
Join Date: Jul 2010
Location: London
Posts: 72
Default Re: PHP page

thanks for your replies.

I have uploaded the test php file, and it shows the date.

Does this mean I dont really need to do anything else, like edit server settings or something?
kash is offline   Reply With Quote
Old 02-25-2011, 04:05 PM   #6 (permalink)
Junior Member
 
Join Date: Feb 2011
Posts: 39
Default Re: PHP page

Yes you can, you could have a .abc123 edtension for the page. Simply use mod_rewrite to rewrite yourfile.php to yourfile.html - where the original file is .php:

Code:
RewriteEngine On
RewriteRule ^/(.*).html /$1.php [R]
Webby Dev Rob is offline   Reply With Quote
Old 02-25-2011, 04:07 PM   #7 (permalink)
Junior Member
 
Join Date: Feb 2011
Posts: 39
Default Re: PHP page

Quote:
Originally Posted by kash View Post
thanks for your replies.

I have uploaded the test php file, and it shows the date.

Does this mean I dont really need to do anything else, like edit server settings or something?
Nope, PHP is working if you can see the date YOu can see all PHP settings if you make a PHP file called say test.php with the following contents:

PHP Code:
phpinfo(); 
Upload test.php to your hosting and then go to www.yoursite.com/test.php
Webby Dev Rob is offline   Reply With Quote
Old 02-28-2011, 03:50 AM   #8 (permalink)
Junior Member
 
johneva's Avatar
 
Join Date: Nov 2010
Location: UK
Posts: 61
Default Re: PHP page

Quote:
Originally Posted by Webby Dev Rob View Post
Nope, PHP is working if you can see the date YOu can see all PHP settings if you make a PHP file called say test.php with the following contents:

PHP Code:
phpinfo(); 
Upload test.php to your hosting and then go to www.yoursite.com/test.php
But his first question was can he run PHP on a HTML extension.

You have only tested the server has php installed and is working. For him to be able to run PHP in a html extension he will need to do as instructed above.
johneva is offline   Reply With Quote
Old 03-01-2011, 09:00 PM   #9 (permalink)
Junior Member
 
Join Date: Feb 2011
Posts: 42
Default Re: PHP page

Hi, welcome to everyone Found a very good website share
Fake Watches For Sale replica-watch-online.com
yiwangdejiyi is offline   Reply With Quote
Old 03-03-2011, 07:33 AM   #10 (permalink)
Junior Member
 
Join Date: Jun 2010
Location: Houston
Posts: 26
Default Re: PHP page

You can configure your webserver to let the php engine process the ".html" files, but not many people would do that. You're better if you keep php code restricted to ".php" files.

If you want to do this for seo purposes, then it is possible for you to achieve this effect via URL rewriting. With URL rewriting, you can tell your server to serve "foo.php" when a browser requests "foo.html", or even "bar.html". You need to research URL rewriting.
ap2010 is offline   Reply With Quote
Reply

Tags
php extension

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 04:35 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting