i have wamp server 2.0...iam new user of php..i wrote my script in notepad and saved it in the directory i created in www folder with extension php..but when i tried to run my script using wamp..the script file is with extension .php.txt and the server just displays my entire code..i cannot see my output..apache server was running...kindly anyone help me..

Dani AI

Generated

Building on the suggestions from , , and , here is a short, focused checklist and a couple of quick tests to isolate why the browser is showing PHP source instead of executing it.

  1. Make sure the page is being served by Apache (not opened directly). Use a URL like:

    Opening the file with file:// or double-clicking it in Explorer will show the source.

  2. Confirm the real filename and extension. Windows can hide extensions so a file that looks like "myscript.php" might actually be "myscript.php.txt". Enable file extensions in Explorer and rename if needed. Example rename from the command prompt:

    ren "myscript.php.txt" myscript.php
  3. Put a tiny test file in the server document root and request it via HTTP to see whether PHP is running:

    <?php
    phpinfo();
    ?>

    If phpinfo() renders, PHP is working and the original problem was the filename or how you opened it.

  4. Use full PHP tags (<?php ... ?>). Short tags (<? ?>) are often disabled and will appear as plain text.

  5. If phpinfo() does not render: check the WAMP tray icon (green = all services running), open the Apache error log via the WAMP menu, and verify the PHP module is enabled in the server configuration. Also try a different editor (Notepad++, VS Code) to avoid hidden-extension issues.

Note: WAMP defaults to C:\wamp\www as the document root (XAMPP uses htdocs). These checks will quickly identify whether the issue is a filename/opening problem, PHP-tag usage, or a server configuration problem.

Recommended Answers

All 3 Replies

Notepad defaults to the extension .txt. You must change the Save As Type drop down menu to all files. You can also wrap it with quotes to save as .php.

i have wamp server 2.0...iam new user of php..i wrote my script in notepad and saved it in the directory i created in www folder with extension php..but when i tried to run my script using wamp..the script file is with extension .php.txt and the server just displays my entire code..i cannot see my output..apache server was running...kindly anyone help me..

edit http.conf file of apache server to accept .php extensions. also write your php scripts in htdocs directory( a good progamming practice not mandatory)

If you are using Notepad to write your PHP scripts, always change the Save Type to All files when saving.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.