473,396 Members | 2,013 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,396 software developers and data experts.

PHP file doesn't execute in local wamp server

I have
wampserver installed and running

>>
WampServer 2.0i [07/11/09]
Includes :
- Apache 2.2.11
- MySQL 5.1.36
- PHP 5.3.0
<<

location
127.0.0.1/nfo.php
when I run the my php file the comments and the server side source appears in the browser, does that mean its working
<? tags are not hiding the source and comments ?> can you tell me
I know I am doing something wrong...
I am very new to php just started today :) Sep 26 2009

Expand|Select|Wrap|Line Numbers
  1.  
  2.     //**************************************
  3.     // Name: Annotate
  4.     // Description:Very simple module to let your users post their comments on your Web pages. Does not require SQL. Does require a writeable directory. by Steve Yelvington
  5.     // By: PHP Code Exchange
  6.     //
  7.     //
  8.     // Inputs:None
  9.     //
  10.     // Returns:None
  11.     //
  12.     //Assumes:None
  13.     //
  14.     //Side Effects:None
  15.     //**************************************
  16.  
  17.  
  18.     /*
  19.     <?
  20.     annotate.php3 
  21.     This is a module that can be placed on any php3 page to allow users to add
  22.     their comments. The comments are stored in a file in the current directory,
  23.     whose name is constructed by adding ".comment" to the calling page's name,
  24.     and merged into the calling page dynamically. (The calling page is not
  25.     modified.)
  26.     I wrote this because I wanted a simple way to add this functionality to my
  27.     pages without requiring that mySQL be available.
  28.     In the message input, blank lines are converted to paragraph tags. No other
  29.     conversions are applied. If you don't want your users to be able to input
  30.     html, uncomment the "strip_tags" line.
  31.     Note that the directory must be writable by the web server.
  32.     Put this module in some convenient location and then embed it in your pages
  33.     like so:
  34.     require("/some/full/path/annotate.php3");
  35.     or, relative to the docroot:
  36.     require($DOCUMENT_ROOT . "/relativepath/php3");
  37.     Steve Yelvington <steve@yelvington.com>
  38.     */
  39.     if ($message)
  40.         {
  41.         /* uncomment the next two lines to strip out html from input */
  42.         /* $name = strip_tags($name); */
  43.         /* $message = strip_tags($message); */
  44.         $message = ereg_replace("\r\n\r\n", "\n<P>", $message);
  45.         $date = date("l, F j Y, h:i a");
  46.         $message = "<B>$name </B> -- $date<P> $message <BR><HR>";
  47.         $fp = fopen (basename($PHP_SELF) . ".comment", "a");
  48.         fwrite ($fp, $message);
  49.         fclose ($fp);
  50.         }
  51.     @readfile(basename(($PHP_SELF . ".comment")));
  52.     ?>
  53.  
  54.  
  55. This part shows up in the browser
  56. what I want to appear in the browser but the <? tags also appears above my FORM post
  57.     <FORM method="post">
  58.     <b>Your name:</b><BR><INPUT name="name" type="text" size="55"><BR>
  59.     <b>Your comment:</b><BR><TEXTAREA name="message" rows=10 cols=55 wrap=virtual>
  60.     </TEXTAREA><BR>
  61.     <INPUT name="submit" type="submit" value="Post your comments">
  62.     </FORM>
  63.  
  64.  
  65.  
  66.  
Sep 26 '09 #1
3 4911
Dormilich
8,658 Expert Mod 8TB
<? ?> are the short tags and have to be enabled in php.ini. it is better to use the proper tags <?php ?>
Sep 26 '09 #2
<? do move the <?php to the top of comments and fuctions. And php?> at the end of the comments fuctions ect...

I copied that source code from http://www.planet-source-code.com/

I like to give your way a try, edit the php.ini later.

Like you said I would have to edit the php.ini.
I would have to look for the php.ini in the wampserver root dir somewhere!
I found wampmanager.ini!

Say if I did change the tags from <? to <?php will that change the program
behavior?

I made changes to another Project!
haha the submit comment is not executing - appending new comments to the output file, On another project I doing made these changes from <? TO <?php.
Sep 26 '09 #3
Dormilich
8,658 Expert Mod 8TB
@oorlando
not a good idea, this will give you an error.
Sep 26 '09 #4

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

Similar topics

0
by: Ian | last post by:
Dear All, I just downloaded & installed MYSQL. It seemed to work and I can start it and enter my password and change a directory but that is about all. I have been ready and playing "hit & miss"...
2
by: Brett B | last post by:
I just installed mysql on linux. If I open a terminal, su to root, then type "mysql", I am able to connect to the server and run my queries. If I exit out of su so that I am my own id (baisley)...
1
by: jiing | last post by:
Now let me describe what I have done and my purpose: Originally, I want to user ports to install phpBB But I found that phpBB doesn't support mysql 5.x (but the ports installed mySQL 5.0.0...
2
by: Mike Malter | last post by:
I am having problems using https when calling a page on my local machine. I am running XP professional. All I get is a general error page telling me there are problems with my page. I have...
23
by: wylbur37 | last post by:
I'm running an Apache server on my own computer (Windows XP Pro). I wrote a simple PHP script (called test3.php) that I'm running by putting the following URL in the address bar of the browser...
2
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
12
by: Darrel | last post by:
I'm still having a hell of a time figuring out this whole SQL Express set up. I finally discovered why I couldn't run the aspnet_regsql...my local sql server wasn't running. I turned that on,...
1
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...
2
by: Bentot | last post by:
For the code below I only see "Hello PhP" and not the Hello World! <h1>Hello PhP</h1> <?php echo "Hello World!"; ?>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
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...
0
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,...
0
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...

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.