Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

1. Introduction to PHP

Lesson 1 of 29 in the free PHP Programming notes on Siksha Sarovar, written by Rohit Jangra.

What is PHP?

PHP (Hypertext Preprocessor) is a server-side scripting language mainly used to create dynamic and interactive web pages. PHP scripts are executed on the server, and the result is sent to the browser as HTML.

Key Features of PHP

  • Open-source and free
  • Easy to learn for beginners
  • Works well with HTML
  • Supports databases like MySQL, PostgreSQL, Oracle
  • Platform independent (Windows, Linux, macOS)

---

History of PHP

  • 1994: PHP was created by Rasmus Lerdorf
  • Initially called Personal Home Page Tools
  • Used to track visits to his online resume
  • Later rewritten and expanded to support databases
  • PHP became very popular for web development

Important Timeline

YearEvent
1994PHP created
1995PHP Tools released publicly
1997PHP/FI introduced
1998PHP 3 released
2000PHP 4 released
2004PHP 5 released
2015PHP 7 released
2020PHP 8 released
Exam Tip: PHP was created by Rasmus Lerdorf in 1994.

---

Versions of PHP and Differences

PHP 3

  • First official version
  • Introduced server-side scripting
  • Limited features

PHP 4

  • Improved performance
  • Introduced Zend Engine
  • Better handling of variables

PHP 5

  • Introduced Object-Oriented Programming (OOP)
  • Better database support
  • XML and exception handling added

PHP 7

  • Major performance improvement
  • Faster execution
  • Reduced memory usage
  • Removed old and unused features

PHP 8

  • Just-In-Time (JIT) compiler
  • Improved error handling
  • New syntax features
  • Better security

Difference Summary Table

FeaturePHP 5PHP 7PHP 8
SpeedModerateFastVery Fast
OOP SupportYesYesAdvanced
Memory UsageHighLowLower
Error HandlingBasicImprovedStrong
Exam Tip: PHP 7 and PHP 8 are faster and more secure than older versions.

---

Practicality of PHP

PHP is very practical for real-world web applications.

Why PHP is Practical?

  • Easy integration with HTML
  • Large community support
  • Runs on most servers
  • Supports many databases
  • Used in real websites like:
  • Facebook (initially)
  • Wikipedia
  • WordPress

Common Uses

  • Login systems
  • Registration forms
  • E-commerce websites
  • Content Management Systems (CMS)
  • Dynamic web pages
Exam Point: PHP is practical because it is easy to use, flexible, and widely supported.

---

Power of PHP

PHP is considered powerful because it can handle both simple and complex web applications.

What Makes PHP Powerful?

  • Handles form data easily
  • Session and cookie management
  • File handling on server
  • Database connectivity
  • Supports OOP concepts
  • Secure with encryption and hashing

PHP Can

  • Generate dynamic page content
  • Create, read, update, delete files
  • Collect form data
  • Send and receive cookies
  • Control user access
Exam Line: PHP is powerful due to its database support, server control, and scalability.

---

Installation and Configuring Apache and PHP

To run PHP, we need:

  1. Web Server (Apache)
  2. PHP Interpreter
  3. Browser

Option 1: Using XAMPP (Recommended for Beginners)

XAMPP includes:

  • Apache Server
  • PHP
  • MySQL
  • phpMyAdmin

Steps to Install XAMPP

  1. Download XAMPP from official website
  2. Install XAMPP
  3. Open XAMPP Control Panel
  4. Start Apache
  5. Check by opening: http://localhost

Testing PHP

Create a file named test.php inside htdocs folder:

<?php
echo "Hello PHP";
?>

Open in browser: http://localhost/test.php

Option 2: Manual Installation (Theory Point)

Steps

  1. Install Apache Server
  2. Install PHP
  3. Configure php.ini
  4. Link PHP with Apache
  5. Restart Apache server
Exam Tip: XAMPP is commonly used for PHP development because it is easy to install and configure.

---

Advantages of PHP

  • Free and open source
  • Easy learning curve
  • Fast execution
  • Cross-platform
  • Large documentation

Limitations of PHP

  • Not suitable for desktop applications
  • Security depends on proper coding
  • Slower than compiled languages