123ArticleOnline Logo
Welcome to 123ArticleOnline.com!
ALL >> Computer-Programming >> View Article

Getting Started With Php: A Beginner's Guide To Your First "hello World" Program

Profile Picture
By Author: Shweta
Total Articles: 14
Comment this article
Facebook ShareTwitter ShareGoogle+ ShareTwitter Share

Introduction
PHP tutorial for beginners and professionals provides in-depth knowledge of PHP scripting language. Our PHP tutorial will help you to learn PHP scripting language easily.
This PHP tutorial covers all the topics of PHP such as introduction, control statements, functions, array, string, file handling, form handling, regular expression, date and time, object-oriented programming in PHP, math, PHP MySQL, PHP with Ajax, PHP with jQuery and PHP with XML.
What is PHP?
PHP is an open-source, interpreted, and object-oriented scripting language that can be executed on the server side. PHP is well suited for web development. Therefore, it is used to develop web applications (an application that executes on the server and generates the dynamic page.).
PHP was created by Rasmus Lerdorf in 1994 but appeared in the market in 1995. PHP 7.0 is the latest version of PHP, which was released on 28 November. Some important points need to be noticed about PHP as followed:
PHP stands for Hypertext Preprocessor.
PHP is an interpreted language, i.e., there is no need for compilation.
PHP can ...
... be embedded into HTML.
PHP is an object-oriented language.
PHP is an open-source scripting language.
PHP is a simple and easy-to-learn language.


Why use PHP?
PHP is a server-side scripting language, which is used to design dynamic web applications with MySQL database.
It handles dynamic content, database as well as session tracking for the website.
You can create sessions in PHP.
It can access cookies variables and also set cookies.
Using PHP language, you can control the user's to access some pages of your website.
It helps to encrypt the data and apply validation.
PHP supports several protocols such as HTTP, POP3, SNMP, LDAP, IMAP, and many more.

PHP Features

Install PHP
To install PHP, we suggest you install the AMP (Apache, MySQL, PHP) software stack. It is available for all operating systems. There are many AMP options available in the market that are given below:
WAMP for Windows
LAMP for Linux
MAMP for Mac
SAMP for Solaris
FAMP for FreeBSD
XAMPP (Cross, Apache, MySQL, PHP, Perl) for Cross Platform: It includes some other components too such as FileZilla, OpenSSL, Webalizer, Mercury Mail, etc.

How to install the XAMPP server on Windows
We will learn how to install the XAMPP server on the Windows platform step by step. Follow the below steps and install the XAMPP server on your system.

Step 1: Click on the above link provided to download the XAMPP server according to your window requirement.
Step 2: After downloading XAMPP, double-click on the downloaded file and allow XAMPP to make changes in your system. A window will pop up, where you have to click on the Next button.
Step 3: Here, select the components you want to install and click Next.


Step 4: Choose a folder where you want to install the XAMPP in your system and click Next
Step 5:nbsp;Clicknbsp;Nextnbsp;and move ahead
Step 6:nbsp; XAMPP is ready to install, so click on thenbsp; Nextnbsp;button and install the XAMPP.
Step 7:nbsp; A finish window will display after successful installation. Click on thenbsp;Finishnbsp;button
Step 8: Choose your preferred language
Step 9: XAMPP is ready to use. Start the Apache server and MySQL and run the PHP program on the localhost.
Step 10: If no error is shown, then XAMPP is running successfully

How to run PHP code in XAMPP
Generally, a PHP file contains HTML tags and some PHP scripting code. It is very easy to create a simple PHP example. To do so, create a file and write HTML tags + PHP code, and save this file with a .php extension.
All PHP code goes between the PHP tag. It starts with lt;?php and ends with ? gt;. The syntax of the PHP tag is given below:
Syntax:

How to run PHP programs in XAMPP PHP is a popular backend programming language. PHP programs can be written on any editor, such as - Notepad, Notepad++, Dreamweaver, etc. These programs save with a .php extension, i.e., filename.php inside the htdocs folder.

For example - p1.php.

As I'm using Windows, and my XAMPP server is installed in D drive. So, the path for the htdocs directory will be "D:\xampp\htdocs".

Step 1: Create a simple PHP program like "Hello World!".


Step 2: Save the file with the hello.php name in the htdocs folder, which resides inside the xampp folder.
Step 3: Run the XAMPP server and start the Apache and MySQL.
Step 4: Now, open the web browser and type localhost http://localhost/hello.php on your browser window.
Step 5: The output for the above hello.php program will be shown in the screenshot below.

Most of the time, PHP programs run as a web server module. However, PHP can also be run on CLI (Command Line Interface).


Credits – Shweta P. (Backend)
MetricsViews Pvt. Ltd.
MetricsViews specializes in building a solid DevOps strategy with cloud-native including AWS, GCP, Azure, Salesforce, and many more. We excel in microservice adoption, CI/CD, Orchestration, and Provisioning of Infrastructure - with Smart DevOps tools like Terraform, and CloudFormation on the cloud.
www.metricsviews.com

Total Views: 126Word Count: 809See All articles From Author

Add Comment

Computer Programming Articles

1. How Web Design Chicago Is Revolutionizing The User Experience For Businesses
Author: Tim Harrison

2. Best It Courses | Which Course In It Is Best?
Author: Kodestree

3. Uv Stabilizers Market Poised To Hit $1.90 Billion By 2032: Growth Trends & Insights
Author: Rutuja Kadam

4. The Ultimate Guide To Choosing The Best Cross-platform App Development Company For Your Business Success
Author: Siddharth

5. Stand-up Pouches Market To Be Worth $52.1 Billion By 2032
Author: Rutuja Kadam

6. Top Full Stack Development Services For Web And Mobile Apps In 2025
Author: jonathan

7. Revolutionize Your Online Presence With Cutting-edge Web Development!
Author: Hitvanshi

8. Top 10 Ibm I Service Providers Right Now
Author: Siddhant Saxena

9. How Mobile Applications Helps Local Businesses Grow?
Author: Ritesh Sharma

10. The Dynamic Landscape Of Advertising Agencies In Indonesia: A Hub For Creativity And Innovation
Author: milestone

11. 10 Advantages Of Building A Career In Full Stack Java Development In Bhopal
Author: Rohan Rajput

12. Top Mobile App Development Company In Canada: Comprehensive Solutions For Your Business
Author: iTechnolabs

13. Democratizing Development: The Rise Of Low-code And No-code Platforms
Author: Techeunoia International

14. Amazon Product Listing Services: Boost Your Sales With Optimized Listings
Author: rachelvandereg

15. Best Accounting Software 2025 In Zambia: Tips And Best Practices
Author: Doris oseR

Login To Account
Login Email:
Password:
Forgot Password?
New User?
Sign Up Newsletter
Email Address: