Writing and Executing PHP Scripts

Notes:

Check for PHP Engine:

Click on the WAMP Server icon on available on the task bar or in the tray, you get a context menu; click on local host option.
You will see “WAMP server home page” open in the default browser.

If you see the “WAMP server home page” open in the default browser then you can say PHP engine is running and you can start writing and executing PHP scripts.

Note: (local host refers to the local server running on the computer system and it points to the root directory of the local server)

Writing and executing PHP scripts:

Writing PHP scripts:

1. Open notepad
2. Type the php code
<?php
echo “Hello World”;
?>

3. Save the file in www directory with the file extension .php
Ex: helloworld.php

Executing PHP scripts:

1. Open the browser
2. Type localhost/helloworld.php

You should see in the browser window the Hello World displayed

Interview Questions: