PHP Basic Programming Vol 2: Executing Source Code

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

--

Motivation

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

Executing Source Code

How to Execute PHP Source Code

We start from this discussion.

  1. first, we have to Create source code with a text editors like Sublime Text or Notepad++.
  2. and then Save the source code into a file with a .php extension in the C:/xampp/htdocs folder.
  3. Open the xampp application and click start in the Apache section.
  4. Open a web browser. Enter the address /localhost/htdocs/filename.php. Filename.php is the file that contains the source code saved in step 1. Don’t forget to write the .php extension after the filename.
Note : 
The picture above is the result of the execution of the PHP program in which there is also the HTML language. The server will read or detect the PHP code When the server finds the <?php tag and ends When it finds the ?> . tag

Both scripts produce the same display. The difference lies in the way the PHP source code is executed.

Note :
The picture above is an example of the HTML language that is loaded using the PHP script

Difference between Running, Debugging and Executable File

  • Running is The process of running a php program so that it is successfully executed
  • Debugging is The process of looking for bugs / errors in programs that have been executed and an error occurs.
  • Executable File is The process of converting a PHP program into an exe file that can be used as an application on a PC

Conclusion

We have come to a conclusion. The conclusion from our discussion is The PHP file is stored in the c:/xampp/htdocs folder so that it can be executed. and then run apache module on xampp application to start execution. 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