473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

"WAMP Server" problem. PHP code not being executed.

Jacotheron
Hi I am new to php. I have started with php as a result of a client. I have downloaded a WAMP (Windows Apaché MySQL PHP). I have a problem: it is proparly installed and everything seems to be working fine except the .php document I try to create. I access the file using the http://localhost/ like the tutorial, I went buying, told me to do but this simple php can't even execute:

Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD>
  3. <TITLE>My First PHP Page</TITLE>
  4. </HEAD>
  5. <BODY>
  6. <?
  7. echo "Hello World!";
  8. ?>
  9. </BODY>
  10. </HTML>
Can someone please tell me what is wrong with the wamp and how to fix this problem?
Jan 21 '08 #1
13 30733
Atli
5,058 Expert 4TB
Hi.

What happens when you try to execute the .php document?
Does the PHP code get displayed in the browser?
Does it get displayed in the source?
Are there any errors?

One thing I would advice tho.
You use <? .. ?> tags in your code. I would recommend using <?php ... ?> tags instead. The former will cause problems on servers using the default PHP settings (PHP5 and above).
Jan 21 '08 #2
Hi.

What happens when you try to execute the .php document?
Does the PHP code get displayed in the browser?
Does it get displayed in the source?
Are there any errors?

One thing I would advice tho.
You use <? .. ?> tags in your code. I would recommend using <?php ... ?> tags instead. The former will cause problems on server using the default PHP settings (PHP5 and above).
Thank you for the help, the tags was the problem and now I can start working with PHP
Jan 22 '08 #3
Markus
6,050 Expert 4TB
Thank you for the help, the tags was the problem and now I can start working with PHP
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. echo "good luck :)";
  3. ?>
  4.  
Jan 22 '08 #4
Atli
5,058 Expert 4TB
Thank you for the help, the tags was the problem and now I can start working with PHP
Glad to hear it :)
Let us know if we can help you with anything else.
Jan 22 '08 #5
WAMP server does n't allow php short tag like <? ?> its allow <?php ?>

to remove this issue simply go php.ini file look short_open_tag and remove ; if any and make it 'on'

short_open_tag on
Jan 25 '08 #6
Atli
5,058 Expert 4TB
WAMP server does n't allow php short tag like <? ?> its allow <?php ?>

to remove this issue simply go php.ini file look short_open_tag and remove ; if any and make it 'on'

short_open_tag on
An easier solution is to just use the <?php ?> tags ;)
They will always work without having to mess with the php.ini config.
Not to mention that on some hosts you don't even have the option to edit the config.
Jan 25 '08 #7
marnus
2
Hi there
I'm new to PHP but know some java and C++, I am trying to install my website (www.eventsnamibia.com) on my PC (localhost). I'm using WAMP 2.0h and PHP 5.2.9-2. I have set the short_open_tag to off, but still see PHP code on webpage as oppose to the actual web content. Does anyone have an idea what I should change. Any help is greatly appreciated. Running Windows XP SP3

Marnus
May 22 '09 #8
Markus
6,050 Expert 4TB
@marnus
If you want to use short tags, you need short_tag_open set to 'On'.
May 22 '09 #9
@marnus
It is not advisable to run a site from your own PC. Then when you use php, a good practice is to always use the "<?php" tags in stead of the "<?" tags, which are shorter. This way you should not have the problem of php code displayed. Do you use an alias or do you have all your files in the www folder? If you do not use the www folder, and have not set up an alias you would not be able to execute the code through php. If you do use an alias (or the www folder) it should work - the reason it is displayed means that it is not executed. Can you access the default page inserted by the instalation (index.php) through the server?

I hope I could help.
May 22 '09 #10
Atli
5,058 Expert 4TB
Just to reiterate this point:

There is absolutely NO advantage in using the short tags, aside from the fact that it saves you a few (very very few) keystrokes.

Whatever effort you think you are saving yourself by using the short tags will almost definitely be lost (and then some) if you ever have to switch servers, or even if you ever decide to upgrade your PHP installation.

It's just not worth the trouble.
May 23 '09 #11
marnus
2
I have sorted the problem, in the end I had to enable short open tags in the Wamp system tray icon option. Also had to disable notices for error_reporting in PHP config file.

The site were designed by someone else, I inherited the short open tags in PHP, will have to look into it to change it. the website is hosted on the internet, i had trouble setting up a localhost installation of the website.
May 23 '09 #12
@zabsmarty
These works to me, thanks a lot.
Jun 8 '09 #13
astrip
1
Hi,

I'm having the same problem with WAMP - the PHP code is not being executed. I use only <?php .. ?> tags.

Do you have any idea what the problem could be?

Thank you
Dec 12 '11 #14

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

Similar topics

1
by: bonnie.tangyn | last post by:
Hello all I get Too few parameters expected 2 error and "The MS Jet Database engine cannot find the input table or query "myTempTablename". Make sure it exists and that its name is spelled...
2
by: Tee | last post by:
Hi, I am currently using Server.MapPath in my aspx files, but because of I am using it more than once, I would like to move these code away from aspx and make it as a public function inside...
2
by: Ravi J | last post by:
I am trying to load Microsoft Word and create a document in ASP.NET (C#). But the call to application creation 'Word._Application app = new Word.ApplicationClass();' takes quit a bit of time, and...
6
by: Andre Ranieri | last post by:
I'm trying to create a login page for customers to log into our corporate website, our presidents naturally wants the user and password fields to populate from a cookie so the customer doesn't have...
1
by: Robert Halford | last post by:
On 4th May at 7.45 in the evening my asp.net web sites stopped working on my development server. The page that appears says: Server Application Unavailable The web application you are...
4
by: Ryan | last post by:
Hello, I have a standard HTML button on an aspx web form that I have set to runat server. The button is named reset1 and its tag is as follows: <INPUT id="btnReset1" style="WIDTH: 60px;...
13
by: Kevin Liebowicz | last post by:
Yes, I wasted the past two days trying to fix this. Yes, this is on a Win2003 Server. Yes, this machine is a domain controller. Yes, I seen the dozens of KB articles like this one:...
6
by: teddysnips | last post by:
In my application I need to allow users to cut 'n' paste stuff from various sources, some of which might include dodgy characters such as "<". Natch, IE interprets these as potentially dangerous...
19
by: Scott M. | last post by:
Why do we need runat="server" on our <headtags?
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...

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.