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 you can download and install xampp I showed it here. Now just follow the rest. You can run your xampp from your Launchpad
Press your Launchpad then find the xampp folder
Press on it. The xampp window will open.
Click on Manage Server
Select the MySQL Database. Which is by default Stopped mode. Start it from the right start button
With the same procedure start the Apache Web Server also.
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.
Here you will see your application folder opened.
You can also open this application folder through the finder option also.
Click on the finder. Then click on the application folder, then find xampp. Here you are
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.
All you know php code has to write within the HTML codes. So firstly I am making the basic HTML page
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
Inside this to write the PHP code we have to type
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.
Now to see your code is running- go to your browser and in the url press localhost.
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