PHP Basic Programming Vol 1: Identifying Source Code Running or Execution Mechanisms

Agung Prabowo
Dev Genius
Published in
3 min readNov 1, 2021

--

Motivation

Hello friends. Maybe many of us are already familiar with what a programming language is and in particular what is the PHP programming language. this time we will start a discussion about the basics of PHP programming. let’s go straight to the first discussion

PHP programming language

PHP belongs to a group of programming languages ​​called scripting languages. Script programming languages ​​do not require a special work environment to run. In general, it can be embedded into the code of another programming language. A PHP file can contain the php code itself, or it can even add HTML, CSS, or JavaScript code.

PHP: Hypertext Preprocessor is a scripting language that can be embedded or embedded into HTML. PHP is a server-side scripting language, a programming language used to develop static websites or dynamic websites or Web applications. Because php is server-side scripting, this type of programming language will later be run/processed by the server. In contrast to HTML which is processed on the client-side. Server-side programming is a type of programming language in which the script/program will be executed/processed by the server.

Source Code Execution Mechanism

Execution / running PHP source code is a process to run a program so that it displays a web page. The PHP file to be run must be in the C:\xampp\htdocs folder. PHP file names must be without spaces and should be lowercase or you can use an underscore (_) instead of a space.

Tools for Executing PHP Source Code

  • Text Editor: Text Editor is used to writing PHP scripts
  • Web Server (Xampp / Wampp): Web Server is used to run the Apache module which functions to read PHP files, it is recommended to use xampp
  • Web Browser (Chrome / Mozilla): The web browser is used as a medium to run and display PHP programs, it is recommended to use the Chrome browser

PHP Source Code Execution Mechanism

  1. The web server sees the file extensions accessed. If the file has a .php extension, the web server will run the PHP module and execute the PHP code contained in the file.
  2. The web server processes the .php file from the first line to the last line sequentially. If the webserver does not find the <?php tag, the code will be treated as HTML code. When the webserver finds the <?php tag, the code will be treated as PHP code until the webserver finds the closing ?> tag.

The function of the extension is so that the server can identify PHP files and scripts. PHP files must be saved with the “.php” extension.

Conclusion

We have come to a conclusion. The conclusion from our discussion is that PHP is a scripting programming language, PHP is also executed on the server-side, then the tools for executing PHP are text editors, web servers, web browsers. We will continue our discussion of Basic PHP in the next article. I hope this article can be useful.

Thank you.

--

--

Interested and learn about programming, web development, and machine learning