PHP Installation and Writing Hello Word Program
PHP Installation and Writing Hello Word Program
This PHP tutorial we will learn PHP installation process step by step, and after installation learn
how to create PHP script file and how to run or execute Php script file on server.
Download WampServer Here: Download WampServer link
Now Click on “Localhost” you have below screen for server configuration. Version configuration
PHP version and Apache Server Version configuration which we have already installed on our
computer system.
Creating Php File
Here, the “www directory” option define the path where we can save the PHP file.
The default location path is “C:\wamp\www“.
We must save all PHP page at in “www” folder.
When we click on “www directory” option on above menu it will locate directly to www folder
in C drive. where we have to save all PHP file.
PHP WampServer by default create a file index.php in www folder. Where we run the index file
on browser it look like: http://localhost/index.php
PHP Hello World on the web browser
Write the following code in the file index.php:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PHP - Hello, World!</title>
</head>
<body>
<h1><?php echo 'Hello, World!'; ?></h1>
</body>
</html>
The code in the index.php file looks like a regular HTML document except the part <?php and
?>
The code between the opening tag <?php and closing tag ?> is PHP:
This PHP code prints out the Hello, World message inside the h1 tag using the echo statement:
When PHP executes the index.php file, it evaluates the code and returns the Hello,
World! message.
http://localhost/index.php
If you see the following on the web browser, then you’ve successfully executed the first PHP
script: