473,657 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot display php code in test file on WAMP server

5 New Member
For the code below I only see "Hello PhP" and not the Hello World!

Expand|Select|Wrap|Line Numbers
  1. <h1>Hello PhP</h1>
  2. <?php
  3. echo "Hello World!";
  4. ?>
  5.  

This html file is in the local folder. and the index.php file inside the local folder works because I can see the WampServer Configuration page when I type http://localhost/ on my browser.

I have Windows Vista

I don't get it. Please help.
Mar 22 '10 #1
2 3342
Bentot
5 New Member
My file extension is .html so I changed it to .php and it worked. I thought it's possible to include PHP codes in html files?
Mar 23 '10 #2
Atli
5,058 Recognized Expert Expert
Hey.

Technically it is possible, but it is not by default. PHP code needs to be executed by the PHP interpreter. Your HTTP server (Apache, in case of WAMP) is configured to only execute certain types of files as PHP code. These are usually just the .php extensions. Normal .html files are just sent as ordinary, non-php HTML files, but you can tell your server to execute any file as PHP code.

Everything inside a .php file, except text within <?php ... ?> tags, is considered HTML by the server (by default). So if you rename a .html file to .php you will see no difference at first. - The only difference is that now the file is run through the PHP interpreter, which will look for <?php ... ?> tags and execute them as PHP code. - Everything outside <?php ... ?> tags, and all the output generated by the code inside the tags, is sent to the browser as HTML. - The browser does not see any difference between a normal .html file and a .php file. It's all just HTML from it's perspective.

Hope that helps :)
Mar 23 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1740
by: crist135 | last post by:
Hi guys, I have successfully done the retrieving of PDF file from Sql Server BLOB. Though, some of the pdf files are displaying it nicely but in some, postscript is being displayed. I am using CutePDF to convert document files to PDF files. The display of a part of one of the file in postscript is illustrated below. Your help regarding on this issue is really much appreciated. Thank you very much. 20061005%PDF-1.4 %⣏Ӎ 1 0 obj << ...
2
2400
by: Gandalf | last post by:
I can't surf my wamp server , Although both of the services seems to be working. When I trying to surf my server the browser loading the page for eternity. thanking you in advance
0
1049
by: diegososa | last post by:
Hi! I'm new here and also new in Python, and i have a simple question: I have: -a python program running on a Linux machine -a Windows XP machine with a WAMP Server, and python for Windows installed too. I wanna: - send a file from the client to the server, in the easiest and most effective way possible, without user interference. I reed a lot about it, but i cannot made it to work. I have seen a couple of options, like PHP, or cgi,...
1
4325
by: fatalparadox | last post by:
I had WAMP Server installed for a few months, everything was fine. Now all of a sudden it stopped working. It still executes the PHP but it doesn't allow me to write to a .txt file anymore. When I put the same files on the web it works great. And it worked with wamp server before yesterday. So I uninstalled WAMP server and installed WAMP Server2 and it still has the same issues.
6
2524
by: praveenkhade | last post by:
I am trying to open the Enterprise manager(sqlserver 2005) but following error is showing "mmc cannot open the selected file". yesterday it was working properly but since morning its not properly working. wat might be the problem?? i am using asp.net2.0, can somebody post answer for this whats the problem?
2
2250
by: robin1983 | last post by:
Hi All, I am facing a problem with WAMP. I installed the wamp5_1.7.1a. After installation, when I try to run the through explorer by writing "http://localhost" but its showing pages cannot be display. I started all the services, still I am not able to access the wamp server. Please kindly help, is there any step that I need to do with my system admin. Thanks in advance for your kind supports. Regards, Robindra Singha
4
4422
by: eschneider | last post by:
I get the following error when trying to browse the .asmx. I get the same thing when trying to add a reference. using .NET 2.0 There is no error message. Any ideas? Thanks,
3
7530
by: robin1983 | last post by:
Dear All, I am facing a problem with WAMP server. i dowonload the WAMP SERVER2.0c and installed in my system. But the problem is that none of the server is running. When i try to access the server by http://localhost, the page cannot display is getting. When I try the same in my own pc its working properly. It seems that the problem is due antivirus which is installed in the system. The system is having McAfree antivirus. OS: Window XP...
7
15223
by: sousou | last post by:
I have installed the wamp server correctly but when i called http://localhost/sam.php for example it didn't work it gave me (the web cannot found this page).
1
2955
by: Louloul | last post by:
Hello I am working with a wamp program. when I load the page, it displays this sentence " Internet Explorer cannot display the webpage ". Here is the code <?php session_start(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <?php
0
8829
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8608
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6172
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4164
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.