PHP – Write First Program on PHP

As you know PHP is server side scripting language. Let me explain few lines on how PHP works with Apache server? 

First of all, the user will send a request through the application layer or web browser to the server via the protocol. And the server will respond to the request by sending an HTML file back to the browser.

It means we have a .php extension of the file but the server will not display .php file, It will show you only HTML file. That is the basic working mechanism of server-side scripting language via the Apache server.


PHP has it’s own syntax to write code, syntax means rules to regulate and formulate the code in the well mannered form.

<?php // will define this is the beginning of PHP programming code.
?> // will define this is the end of PHP programming code.

First Program on PHP


            First PHP
    <!-start of php code->
        echo 'This is My First Program on PHP';
    <!-end of php code->


You need to run Apache server to execute your .php file. Below the output you can see the inspect element, there you can see only the HTML code, not PHP code.

PHP code is not visible to users through a web browser. It will remain visible on the server only.


About Author provides tutorials related to tech and programmings. We are also setting up a community for the users and students.