0% found this document useful (0 votes)
14 views18 pages

Understanding Website Components and Types

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views18 pages

Understanding Website Components and Types

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

PHP Programming

Unit -1
What is a Website ?:
A website is a collection of many web pages, and web pages are digital files that are
written using HTML(HyperText Markup Language). To make your website
available to every person in the world, it must be stored or hosted on a computer
connected to the Internet round a clock. Such computers are known as a Web Server.

The website’s web pages are linked with hyperlinks and hypertext and share a
common interface and design. The website might also contain some additional
documents and files such as images, videos, or other digital assets.

With the Internet invading every sphere, we see websites for all kinds of causes and
purposes. So, we can also say that a website can also be thought of as a digital
environment capable of delivering information and solutions and promoting
interaction between people, places, and things to support the goals of the
organization it was created for.

Components of a Website:

We know that a website is a collection of a webpages hosted on a web-server.


These are the components for making a website.

[Link]:

Hosting is the location where the website is physically located. Group of


webpages (linked webpages) licensed to be called a website only when the webpage
is hosted on the webserver. The webserver is a set of files transmitted to user
computers when they specify the website’s address.

[Link]:

Address of a website also known as the URL of a website. When a user wants
to open a website then they need to put the address or URL of the website into the
web browser, and the asked website is delivered by the webserver.

[Link]:

Home page is a very common and important part of a webpage. It is the first
webpage that appears when a visitor visits the website. The home page of a website
is very important as it sets the look and feel of the website and directs viewers to the
rest of the pages on the website.

[Link]:

It is the final and overall look and feel of the website that has a result of
proper use and integration elements like navigation menus, graphics, layout,
navigation menus etc.

[Link]:

Every web pages contained on the website together make up the content of the
website. Good content on the webpages makes the website more effective and
attractive.

[Link] Navigation Structure:

The navigation structure of a website is the order of the pages, the collection
of what links to what. Usually, it is held together by at least one navigation menu.

How to access Websites?


When we type a certain URL in a browser search bar, the browser requests the
page from the Web server and the Web server returns the required web page and its
content to the browser. Now, it differs from how the server returns the information
required in the case of static and dynamic websites.
Types of Website:

i. Static Website
ii. Dynamic Website

Static Website:

In Static Websites, Web pages are returned by the server which are prebuilt
source code files built using simple languages such as HTML, CSS, or JavaScript.
There is no processing of content on the server (according to the user) in Static
Websites. Web pages are returned by the server with no change therefore, static
Websites are fast. There is no interaction with databases. Also, they are less costly as
the host does not need to support server-side processing with different languages.

Dynamic Website:

In Dynamic Websites, Web pages are returned by the server which is


processed during runtime means they are not prebuilt web pages, but they are built
during runtime according to the user’s demand with the help of server-side scripting
languages such as PHP, [Link], [Link] and many more supported by the server.
So, they are slower than static websites but updates and interaction with
databases are possible. Dynamic Websites are used over Static Websites as updates
can be done very easily as compared to static websites (Where altering in every page
is required) but in Dynamic Websites, it is possible to do a common change once,
and it will reflect in all the web pages.

Dynamic Website is a website containing data that can be mutable or


changeable. It uses client-side or server scripting to generate mutable content. Like a
static website, it also contains HTML data.
Dynamic websites are those websites that changes the content or layout with
every request to the webserver. These websites have the capability of producing
different content for different visitors from the same source code file. There are two
kinds of dynamic web pages i.e. client side scripting and server side scripting. The
client-side web pages changes according to your activity on the web page. On the
server-side, web pages are changed whenever a web page is loaded.
Example: login & signup pages, application & submission forms, inquiry and
shopping cart pages.
A Typical Architecture of dynamic website
There are different languages used to create dynamic web pages like PHP,
ASP, .NET and JSP. Whenever a dynamic page loads in browser, it requests the
database to give information depending upon user’s input. On receiving information
from the database, the resulting web page is applied to the user after applying the
styling codes.
Features of dynamic webpage:
 These websites are very flexible.
 In these websites the content can be quickly changed on the user’s computer
without new page request to the web browser.
 In these websites the owner have the ability to simply update and add new
content to the site.
 These websites are featured with content management system, e-commerce
system and intranet or extranet facilities.
 Most of the dynamic web content, is assembled on the web using server-scripting
languages.
Advantages of dynamic webpage:
 It provides more functional websites.
 It is very easy to update.
 It helps in the search engines because new content brings people back to the site.
 These are interactive websites because these can be customized.
 These websites can work as a system to allow staff or users to collaborate.
 It’s easy to modify or update data.
 It provides a user-friendly interactive interface for users.
 proves smooth navigation.
 provide interactive user interface
 It provides a better user experience.
 It provides real-time data.

Disadvantages of dynamic webpages:


 These types of websites are complex.
 These are more expensive to develop.
 Hosting of these websites is also costlier.
 It requires a rapid, high-end web server.
 High production costs.
 Slow to load content.
 Client will require a skilled programmer to build a dynamic website.
 Hosting a website is costly as compared to a dynamic website.
 Low speed compared to a static website
Application of Dynamic Website:
Here is a list of application where we use dynamic website over static website
 Online booking system:
 E-commerce website.
 Voting or polls,
 Forums
 E-newsletter.

Real-life application:
Here is a list of application where we use dynamic website in real world.
 Facebook
 Twitter
 LinkedIn
 Online booking website.
 Social media
There are different types of websites on the whole internet, we had chosen some
most common categories to give you a brief idea –

Blogs:

These types of websites are managed by an individual or a small group of


persons, they can cover any topics — they can give you fashion tips, music tips,
travel tips, fitness tips. Nowadays professional blogging has become an external
popular way of earning money online.

E-commerce:

These websites are well known as online shops. These websites allow us to
make purchasing products and online payments for products and services. Stores can
be handled as standalone websites.
Portfolio:

These types of websites acts as an extension of a freelancer resume. It


provides a convenient way for potential clients to view your work while also
allowing you to expand on your skills or services.

Brochure:

These types of websites are mainly used by small businesses, these types of
websites act as a digital business card, and used to display contact information, and
to advertise services, with just a few pages.

News and Magazines:

These websites needs less explanation, the main purpose of these types of
websites is to keep their readers up-to-date from current affairs whereas magazines
focus on the entertainment.

Social Media:

We all know about some famous social media websites like Facebook,
Twitter, Reddit, and many more. These websites are usually created to let people
share their thoughts, images, videos, and other useful components.

Educational:

Educational websites are quite simple to understand as their name itself


explains it. These websites are designed to display information via audio or videos
or images.

Portal:

These types of websites are used for internal purposes within the school,
institute, or any business, These websites often contain a login process allowing
students to access their credential information or allows employees to access their
emails and alerts.
PHP Introduction:
The term PHP is an acronym for – Hypertext Preprocessor. PHP is a server-
side scripting language designed specifically for web development. It is an open-
source which means it is free to download and use. It is very simple to learn and use.
The file extension of PHP is “.php”.

What is a Server?
A server is a hardware device or software that processes requests sent over a
network and replies to them. A client is the device that submits a request and waits
for a response from the server. The computer system that accepts requests for online
files and transmits those files to the client is referred to as a “server” in the context
of the Internet.
Types of Servers
1. Application Server
2. Catalog Server
3. Communication Server
4. Computing Server
5. Database Server
6. Fax Server
8. Game Server
9. Mail Server
10. Print Server
11. Proxy Server
12. Web Server
Where Are Servers Stored?
A server is stored in a closet or glass house. These areas help isolate sensitive
computers and equipment from people who should not access them.

What is PHP?
PHP is a server-side scripting language created primarily for web development but it
is also used as a general-purpose programming language. Unlike client-side
languages like JavaScript, which are executed on the user’s browser, PHP scripts run
on the server. The results are then sent to the client’s web browser as plain HTML.
History of PHP
PHP was introduced by Rasmus Lerdorf in 1994, the first version and participated
in the later versions. It is an interpreted language and it does not require a compiler.
The language quickly evolved and was given the name “PHP,” which initially
named was “Personal Home Page.”
Version Description

Version 1.0 Officially called "Personal Home Page Tools (PHP Tools)". This is
(8 June 1995) the first use of the name "PHP".

Officially called "PHP/FI 2.0". This is the first release that could
Version 2.0
actually be characterised as PHP, being a standalone language
(1 November 1997)
with many features that have endured to the present day.

Development moves from one person to multiple developers.


Version 3.0 Zeev Suraski and Andi Gutmans rewritten the base for this
(6 June 1998) version. The name of the language was also changed to the
recursive acronym PHP: Hypertext Preprocessor.
Version 4.0 Added more advanced two-stage parse/execute tag-parsing
(22 May 2000) system called the Zend engine.

Version 5.0
Zend Engine II with a new object model.
(13 July 2004)

Performance improvements with the introduction of compiler


Version 5.1 variables in re-engineered PHP Engine.
(24 November 2005) Added PHP Data Objects (PDO) as a consistent interface for
accessing databases.

Version 6.x Abandoned version of PHP that planned to include native


Not released Unicode support.

 Zend Engine 3 ,
 Uniform variable syntax,
 Added Closure:call(),
Version 7.0  ?? (null coalesce) operator,
(3 December 2015)  Return type declarations,
 Scalar type declarations,
 <=> "spaceship" three-way comparison operator,
 Anonymous classes

Version 7.3
Flexible Heredoc and Nowdoc syntax
(6 December 2018)

 Just-In-Time (JIT) compilation,


 Arrays starting with a negative index,
 TypeError on invalid arithmetic/bitwise operators,
 Variable syntax tweaks,
Version 8.0
 Attributes,
(26 November 2020)
 Named arguments,
 Match expression,
 Union types, Mixed type,
 Static return type
Characteristics of PHP
 PHP code is executed in the server.
 It can be integrated with many databases such as Oracle, Microsoft SQL
Server, MySQL, PostgreSQL, Sybase, and Informix.
 It is powerful to hold a content management system like WordPress and can
be used to control user access.
 It supports main protocols like HTTP Basic, HTTP Digest, IMAP, FTP, and
others.
 Websites like [Link] and [Link] are also built on
PHP.
 One of the main reasons behind this is that PHP can be easily embedded in
HTML files and HTML codes can also be written in a PHP file.
 The thing that differentiates PHP from the client-side language like HTML is,
that PHP codes are executed on the server whereas HTML codes are directly
rendered on the browser. PHP codes are first executed on the server and then
the result is returned to the browser.
 The only information that the client or browser knows is the result returned
after executing the PHP script on the server and not the actual PHP codes
present in the PHP file. Also, PHP files can support other client-side scripting
languages like CSS and JavaScript.
How PHP Works?
PHP scripts are executed on the server. Here’s a typical flow of how PHP works:
 A user requests a PHP page via their web browser.
 The server processes the PHP code. The PHP interpreter parses the script,
executes the code, and generates HTML output.
 The server sends the generated HTML back to the client’s browser, which
renders the web page.
This server-side processing allows for dynamic content generation and ensures
that sensitive code is not exposed to the client.
Syntax
<?php
// PHP code goes here
?>

Basic Example of PHP


<!DOCTYPE html>
<html>
<head>
<title>PHP Hello World</title>
</head>

<body>
<?php
echo "Hello, World! This is PHP code";
?>
</body>
</html>

Output:
Hello, World! This is PHP code

PHP Installation and Configuration


To get started with PHP, you need to set up a local environment.
Here’s a simple guide:
Install a Web Server: Apache or Nginx are popular choices.
Install PHP: Download and install the latest version of PHP from
the official PHP website.
Install a Database: MySQL or MariaDB are commonly used with PHP.
Configure PHP: Update the [Link] file to configure PHP settings
as needed.
For beginners, a complete package like XAMPP (Windows) or MAMP
(macOS) is recommended, as it comes bundled with Apache, PHP, and
MySQL.
Features of PHP
 Dynamic Typing: PHP is dynamically typed, meaning you don’t
need to declare the data type of a variable explicitly.
 Cross-Platform: PHP runs on various platforms, making it
compatible with different operating systems.
 Database Integration: PHP provides built-in support for
interacting with databases, such as MySQL, PostgreSQL, and
others.
 Server-Side Scripting: PHP scripts are executed on the server,
generating HTML that is sent to the client’s browser.
Applications of PHP
PHP is versatile and can be used in a variety of web development
scenarios, including:
 Dynamic Web Pages: Generating dynamic content based on user
interaction or other conditions.
 Content Management Systems (CMS): Many popular CMSs like
WordPress, Joomla, and Drupal are built with PHP.
 E-commerce Platforms: PHP is commonly used to develop e-
commerce websites due to its database integration
capabilities.
 Web Applications: PHP is used for creating feature-rich web
applications such as social media platforms, forums, and
customer relationship management (CRM) systems.
 API Development: PHP can be used to create APIs for web and
mobile applications.
Why should we use PHP?
PHP can actually do anything related to server-side
scripting or more popularly known as the backend of a website.
For example, PHP can receive data from forms, generate dynamic
page content, can work with databases, create sessions, send and
receive cookies, send emails, etc. There are also many hash
functions available in PHP to encrypt users’ data which makes PHP
secure and reliable to be used as a server-side scripting
language. So these are some of PHP’s abilities that make it
suitable to be used as a server-side scripting language.
Even if the above abilities do not convince you of PHP,
there are some more features of PHP. PHP can run on all major
operating systems like Windows, Linux, Unix, Mac OS X, etc.
Almost all of the major servers available today like Apache
supports PHP. PHP allows using a wide range of databases. And the
most important factor is that it is free to use and download and
anyone can download PHP from its official source: [Link].

Advantages of PHP
 Open Source: PHP is an open-source language, meaning it is
freely available for anyone to use and distribute. This
openness has fostered a large and active community of
developers who continuously contribute to its growth,
improvement, and feature development.
 Easy to Learn: The syntax of PHP is quite similar to C and
other programming languages. This makes PHP relatively easy to
learn, especially for developers who already have some
programming experience. Beginners find it approachable due to
its straightforward syntax and extensive online resources.
 Web Integration: PHP is designed specifically for web
development and is embedded within HTML. It seamlessly
integrates with various web technologies, facilitating the
creation of dynamic and interactive web pages.
 Database Support: PHP has excellent support for various
databases, including MySQL, PostgreSQL, SQLite, and more. This
makes it easy to connect and interact with databases, a
crucial aspect of many web applications.
 Cross-Platform Compatibility: PHP is platform-independent and
runs on various operating systems, including Windows, Linux,
macOS, and others. This ensures compatibility across different
environments.
 Large Community and Documentation: PHP has a vast and active
community of developers. The abundance of online resources,
tutorials, and documentation makes it easier for developers to
find solutions and seek help when needed.
 Frameworks and CMS: There are popular PHP frameworks like
Laravel, Symfony, and CodeIgniter, which provide pre-built
modules and features, aiding in rapid development.
Additionally, PHP supports widely used content management
systems (CMS) like WordPress and Joomla.
 Server-Side Scripting: PHP scripts are executed on the server,
reducing the load on the client’s side. This server-side
scripting capability is crucial for generating dynamic content
and performing server-related tasks.
 Community Support: The PHP community actively contributes to
the language’s development, ensuring regular updates, security
patches, and improvements.
Disadvantages of PHP
 Inconsistency: PHP has been criticized for inconsistencies in
function names and parameter orders. This can lead to
confusion for developers, especially when working with a mix
of older and newer functions.
 Security Concerns: If not handled properly, PHP code may be
susceptible to security vulnerabilities, such as SQL injection
and cross-site scripting (XSS). Developers need to be cautious
and follow best practices to secure PHP applications.
 Performance: While PHP performs well for many web
applications, it may not be as fast as some compiled languages
like C or Java. However, advancements and optimizations in
recent versions have improved performance.
 Lack of Modern Features: Compared to newer languages, PHP may
lack some modern language features. However, recent versions
of PHP have introduced improvements and features to address
this concern.
 Scalability Challenges: PHP can face challenges when it comes
to scaling large and complex applications. Developers may need
to adopt additional tools or frameworks to address scalability
issues.
 Not Suitable for Large-Scale Applications: While PHP is
suitable for small to medium-sized projects, it might not be
the best choice for extremely large and complex applications
where more structured languages might be preferred.
 Limited Object-Oriented Programming (OOP) Support: Although PHP
supports OOP, its implementation has been criticized for not
being as robust as in some other languages. However, recent
versions have introduced improvements to enhance OOP
capabilities.

Scope of php:
The primary scope of PHP programming language lies in web
development, where it is used to create dynamic and interactive
websites and applications, including features like user
authentication, database interaction, and content management,
making it a popular choice for building complex online platforms
and e-commerce stores; its ease of use and integration with HTML
further enhance its applicability across various web development
scenarios.
Key aspects of PHP's scope:
Dynamic Website Creation: Generating dynamic content on web pages
based on user input or database data.
Database Management: Connecting to and manipulating databases to
store and retrieve information.
Form Processing: Handling user form submissions and data
validation.
User Authentication: Implementing login systems to control access
to protected website areas.
Content Management Systems (CMS): Powering popular CMS platforms
like WordPress, Drupal, and Joomla.
E-commerce Applications: Building online shopping carts and
payment gateways.
API Development: Creating web services to interact with other
applications.

The installation process in Windows:


STEP 1- Open any web browser and visit [Link] On the
home page, you can find the option to download XAMPP for three platforms- Windows, MAC,
and Linux. Click on XAMPP for Windows. The latest version available on the website
is 7.4.5.

As soon as you click on it, a message displaying the automatic start of download appears on
the screen.

STEP 2- After the download is completed, double click the .exe extension file to start the
process of installation.

STEP 3- A pop-up screen with the message asking you to allow to make changes on your
desktop appears. Click "YES" to continue the process.
STEP 4- Click to Allow access or deactivate the firewall and any other antivirus software
because it can hamper the process of installation.

STEP 5- Just before the installation, a pop-up window appears with a warning to disable
UAC. User Account Control (UAC) interrupts the XAMPP installation because it restricts the
access to write to the C: drive.
STEP 6- After clicking the .exe extension file, the XAMPP setup wizard opens spontaneously.
Click on "NEXT" to start the configuration of the settings.

STEP 7- After that, a 'Select Components' panel appears, To get a complete localhost server,
it is recommended to install using the default options of containing all available components.
Click "NEXT" to proceed further.

STEP 8- The setup is now ready to install, and a pop-up window showing the same appears
on the screen. Click "NEXT" to take the process forward.
STEP 9- Select the location where the XAMPP software packet needs to be installed. The
original setup creates a folder titled XAMPP under C:\ for you. After choosing a location, click
"NEXT".

STEP 10- After choosing from all the previously mentioned preferences click to start the
installation.

STEP 11- After the successful installation of the XAMPP setup on your desktop, press the
"FINISH" button.
On clicking the FINISH button, the software automatically launches, and the CONTROL
PANEL is visible. The image below shows the appearance of the final result.

Common questions

Powered by AI

PHP supports server-side scripting, allowing it to generate dynamic content and interact with databases, making it suitable for dynamic web applications . Its open-source nature, cross-platform compatibility, and ability to integrate with various databases like MySQL and PostgreSQL enhance its versatility. PHP's wide community support further contributes to its adaptability, as it benefits from continuous improvements and extensive documentation .

A CMS built with PHP facilitates easy updates and content management through its flexible scripting capabilities, promoting simple interface changes without coding on each page individually. PHP-based CMS platforms like WordPress allow for easy plugin integration, enabling feature expansion and user interactivity while maintaining a user-friendly interface for managing web content . The inherent ability of PHP to interact with databases supports dynamic content management efficiently .

PHP enhances dynamic websites by executing scripts on the server to generate HTML output, enabling real-time data updates and secure processing. It is preferred for server-side scripting due to its ability to integrate with numerous databases, support for creating dynamic web applications, and wide adoption owing to its open-source nature and compatibility with various platforms . Its server-side execution ensures that sensitive code is not exposed to the client, providing a secure and dynamic user experience .

Dynamic websites improve user engagement by offering interactive features and personalized content updates based on user input or behavior, utilizing server-side scripting and database interactions . Content management in dynamic websites is more efficient, as updates can be applied globally without editing each page individually, enabling easier maintenance and consistent user experience . This flexibility fosters a more engaging and responsive environment than static websites, which serve identical content regardless of user interaction .

A web server hosts website files and responds to user requests by delivering web pages to browsers. For static websites, it serves prebuilt HTML files directly to users, ensuring fast and straightforward page delivery without server-side processing . For dynamic websites, the server processes server-side scripts at runtime to generate the requested web pages based on user input, which involves database interactions and results in more complex, mutable content delivery .

PHP is effective for e-commerce platforms due to its robust database integration capabilities, facilitating efficient inventory management, transactions, and user data handling . It allows for dynamic page generation, enabling personalized user experiences and quick updates to product listings. Moreover, the availability of numerous PHP-based frameworks and CMS systems aids rapid development and provides pre-built e-commerce modules, streamlining the setup of secure, scalable, and feature-rich online stores .

PHP's server-side execution significantly enhances web security by processing code on the server, ensuring that clients receive only the resultant HTML, not the underlying script, thus preventing direct access to sensitive logic and database queries. This approach minimizes exposure to vulnerabilities common to client-side execution, like code manipulation and data breaches. However, developers must follow security best practices, as PHP applications can still be vulnerable to server-side attacks like SQL injection if not properly secured .

PHP's open-source nature allows developers to freely use and modify its source code, fostering a large community that continuously contributes to its development and enhances its feature set. This communal support bolsters PHP's reliability, security through regular updates, and documentation availability, making it accessible and cost-effective for developers to implement in diverse web applications .

Static websites deliver prebuilt web pages written in HTML, CSS, or JavaScript, with no server-side processing or content change based on user input, making them faster and less costly but limited in interactivity . Dynamic websites, on the other hand, generate and assemble content at runtime utilizing server-side scripting languages like PHP, enabling updates and database interactions, thereby providing a more interactive user experience but at the cost of reduced speed and higher development complexity .

Web hosting is crucial for a website's availability, as it provides the infrastructure to store and serve website files to users 24/7. The choice of a web host affects site performance, load speed, and reliability, as efficient hosting ensures quick data transmission and less downtime, especially critical for dynamic websites that require more server resources. Additionally, hosting impacts security, as a well-managed host will provide protections against cyber threats, which are essential for maintaining seamless user interaction and site integrity .

You might also like