mostafaznv mostafaznv - 1 month ago 20
PHP Question

Wamp does not execute php code

It happened today!
The

wamp
server does not execute my php code.

It worked fine yesterday!

This first screen-shot shows my project. It seems blank , but I wrote
<? php echo "s" ?>
on that.
The second screen-shot is source PHP code of my project into Google Chrome.

pic 1

pic 2

Answer

You have to open your page not via file://... but with

http://127.0.0.1/path/to/your/server/document/root/your-script.php

or

http://localhost/path/to/your/server/document/root/your-script.php .

By default on xampp/wamp installations this path is <install_folder>/xampp/ or <install_folder>/wamp/ and in this path resides the document root (folder with name www for wamp installation or htdocs for xampp).

Also it is general good idea to replace spaces in your sub-folder with slashes - or underscore _, however this is not mandatory for your scripts to work.