How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

PHP is the most popular web backend programming language. PHP can also be run on the Command Line Interface. Today I will show you the exact procedure of how PHP code runs.

We can run PHP code in 2 ways. First inner local pc by installing apache server and MySQL as database. You can use another database also. But widely PHP is used with the MySQL database. If you don’t know how to use the local computer as your hosting then please see our this article.

As I mentioned at the beginning of my article that making the environment for PHP programming is so easy. There is so many package program which gives you the both Apache server and my SQL database jointly. I personally use xampp.

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

How you can download and install xampp I showed it here. Now just follow the rest. You can run your xampp from your Launchpad

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

Press your Launchpad then find the xampp folder

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

Press on it. The xampp window will open.

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

Click on Manage Server

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

Select the MySQL Database. Which is by default Stopped mode. Start it from the right start button

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

With the same procedure start the Apache Web Server also.

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

Now go to your application folder. You can go to your application folder in 2 ways. Number one from the xampp application manager. Again back to the Welcome menu.

Click on the Open Application folder.

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

Here you will see your application folder opened.

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

You can also open this application  folder through the finder option also.

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

Click on the finder. Then click on the application folder, then find xampp. Here you are

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

Now open your text editor. Firstly not to use any idea. Use the editor. In my next article, I will tell you the difference between the ice and the text editor. As a text editor, I personally use the sublime text.

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

All you know php code has to write within the HTML codes. So firstly I am making the basic HTML page

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

The most important thing save your file with the extension of .php. As I have shown in the image.

This is the sample structure of an HTML page

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

Inside this to write the PHP code we have to type

<?php       >

And inside this, we have to write our PHP codes

See the screenshot. Here I am using the first php echo code. This will show in our browser that My First PHP Program.

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

Now to see your code is running- go to your browser and in the url press localhost.

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

Here I made the folder for our first program is a test. Click one it

Wow, you have successfully run your first PHP program. To know all about php stay with wordsence. Its a series PHP programming tutorial. Thank you

How PHP code works, Write your first PHP Code
How PHP code works, Write your first PHP Code

NO COMMENTS

LEAVE A REPLY