0% found this document useful (0 votes)
21 views36 pages

Chap1 1.1 To 1.3

PHP is a server-side scripting language used primarily for web development, originally created in 1994 by Rasmus Lerdorf. It has evolved through various versions, with PHP 7 and the current PHP 8.1.9 offering modern features and improved performance. MySQL, an open-source relational database management system, complements PHP and has a rich history of development since its inception in 1979, with significant milestones including its acquisition by Sun Microsystems and Oracle.

Uploaded by

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

Chap1 1.1 To 1.3

PHP is a server-side scripting language used primarily for web development, originally created in 1994 by Rasmus Lerdorf. It has evolved through various versions, with PHP 7 and the current PHP 8.1.9 offering modern features and improved performance. MySQL, an open-source relational database management system, complements PHP and has a rich history of development since its inception in 1979, with significant milestones including its acquisition by Sun Microsystems and Oracle.

Uploaded by

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

Chapter 1

Introduction To PHP
Marks 12
1.1 What is PHP?
● PHP stands for PHP: Hypertext Preprocessor, and it is a server-side scripting
language.

● PHP is the web development language written by and for web developers. The product
was originally named Personal Home Page Tools, and many people still think that’s
what the acronym stands for, but as it expanded in scope, a new and more appropriate
(albeit GNU-ishly recursive) name was selected by community vote.

● PHP is a server-side scripting language, usually used to create web applications in


combination with a web server, such as Apache. PHP can also be used to create
command-line scripts akin to Perl or shell scripts, but such use is much less common
than PHP’s use as a web language.

● Strictly speaking, PHP has nothing to do with layout, events or really anything about the
look and feel of a web page. In fact, most of what PHP does is invisible to the end user.
Someone looking at a PHP page will not necessarily be able to tell that it was not
written purely in Hypertext Markup Language (HTML), because the result of PHP is
usually HTML.

● When your Web browser accesses a URL, it is making a request to a Web server. When
you request a PHP page, something like http://www.yourcompany.com/home.php, the
Web server wakes up the PHP parsing engine and says, “Hey! You’ve got to do
something before I send a result back to this person’s Web browser.” Then the PHP
parsing engine runs through the PHP code found in home.php, and returns the
resulting output. This output is passed back to the Web server as part of the HTML code
in the document, which in turn is passed on to your browser, which displays it to you.

1.2 History of PHP


PHP as it's known today is actually the successor to a product named PHP/FI. Created in
1994 by Rasmus Lerdorf, the very first incarnation of PHP was a simple set of Common
Gateway Interface (CGI) binaries written in the C programming language. The common
gateway interface (CGI) is a standard way for a Web server to pass a Web user's request to
an application program and to receive data back to forward to the user.

Originally used for tracking visits to his online resume, he named the suite of scripts
"Personal Home Page Tools," more frequently referenced as "PHP Tools."

He eventually combined these tools with a form interpretation (FI) package he had
written, added some database support, and released what was known as PHP/FI.

Then, in the spirit of open source software development, developers all over the world
began contributing to PHP/FI. By 1997, more than 50,000 Web sites were using
PHP/FI to accomplish different tasks—connecting to a database, displaying
dynamic content, and so on.

At that point, the development process really started becoming a team effort. With
primary assistance from developers Zeev Suraski and Andi Gutmans, the version 3.0
parser was created. The final release of PHP 3.0 occurred in June of 1998, when it
was upgraded to include support for multiple platforms (it’s not just for Linux
anymore!) and Web servers, numerous databases, and SNMP (Simple Network
Management Protocol) and IMAP (Internet Message Access Protocol)

PHP 4.0 marked a complete rethinking of the PHP core and a rewrite of the
internals of the scripting language itself, with a long list of new and useful
features.

When PHP 5.0 was released, having new concepts of object-oriented development
and database work.

PHP 6 - planned to include native Unicode support but never released.

PHP7 current version During 2014 and 2015, a new major PHP version was
developed, which was numbered PHP 7 with following features.

Many fatal- or recoverable-level legacy PHP error mechanisms were replaced with
modern object-oriented exceptions

● Support for legacy PHP 4-style constructor methods was deprecated


● The behavior of the foreach statement was changed to be more predictable
● Constructors for the few classes built-in to PHP which returned null upon failure were
changed to throw an exception instead, for consistency
● Several unmaintained or deprecated server application programming interfaces (SAPIs)
and extensions were removed from the PHP core, most notably the
legacy mysql extension
● The left-shift and right-shift operators were changed to behave more consistently
across platforms
● Current stable release 8.1.9 from 04-08-2022.

PHP Syntax

A PHP script is executed on the server, and the plain HTML result is sent
back to the browser.

Basic PHP Syntax

A PHP script can be placed anywhere in the document.

A PHP script starts with <?php and ends with ?>:

<?php

// PHP code goes here

?>

The default file extension for PHP files is ".php".

A PHP file normally contains HTML tags, and some PHP scripting code.

Below, we have an example of a simple PHP file, with a PHP script that uses a
built-in PHP function "echo" to output the text "Hello World!" on a web page:

Example

<!DOCTYPE html>

<html>

<body>
<h1>My first PHP page</h1>

<?php

echo "Hello World!";

?>

</body>

</html>

1.3 What is MySQL


MySQL is an open source, SQL relational database management system (RDBMS) that
is free for many uses . Early in its history, MySQL occasionally faced opposition because
of its lack of support for some core SQL constructs such as subselects and foreign keys.
Ultimately, however, MySQL found a broad, enthusiastic user base for its liberal
licensing terms, perky performance, and ease of use. Its acceptance was aided in part
by the wide variety of other technologies such as PHP, Perl, Python, and the like that
have encouraged its use through stable, well-documented modules and extensions.

Databases are generally useful, perhaps the most consistently useful family of software
products in modern computing. Like many competing products, both free and
commercial, MySQL isn’t a database until you give it some structure and form.

The MySQL website (http://www.mysql.com/) provides the latest information about


MySQL software.
● MySQL is a database management system.
● MySQL databases are relational.
● MySQL software is Open Source.
● The MySQL Database Server is very fast, reliable, scalable, and easy to use.
● MySQL Server works in client/server or embedded systems.
● A large amount of contributed MySQL software is available.
The Main Features of MySQL
● Written in C and C++.

● Tested with a broad range of different compilers.

● Works on many different platforms.


● Designed to be fully multithreaded using kernel threads, to easily use multiple CPUs if
they are available.

● Provides transactional and non transactional storage engines.

● Executes very fast joins using an optimized nested-loop join.

Security
● A privilege and password system that is very flexible and secure, and that enables
host-based verification.

● Password security by encryption of all password traffic when you connect to a server.

Scalability
● Support for large databases. We use MySQL Server with databases that contain 50
million records.

Connectivity
● Clients can connect to MySQL Server using several protocols:

o Clients can connect using TCP/IP sockets on any platform.

o On Windows systems, clients can connect using named pipes if the server is
started with the named_pipe system variable enabled. Windows servers also
support shared-memory connections if started with the shared_memory system
variable enabled.
o On Unix systems, clients can connect using Unix domain socket files.

1.4 History of MySQL


MySQL is an open source database product that was created by MySQL AB, a
company founded in 1995 in Sweden. In 2008, MySQL AB announced that it had
agreed to be acquired by Sun Microsystems for approximately $1 billion.
Initial Efforts

The project of MySQL was started in 1979, when MySQL's inventor, Michael Widenius
developed an in-house database tool called UNIREG for managing databases. After that
UNIREG has been rewritten in several different languages and extended to handle big
databases. After some time Michael Widenius contacted David Hughes, the author of
mSQL, to see if Hughes would be interested in connecting mSQL to UNIREG's B+ ISAM
handler to provide indexing to mSQL. That's the way MySQL came in existence.

MySQL is named after the daughter of Michael Widenius whose name is "My".

Milestones
Additional milestones in MySQL development included:

● First internal release on 23 May 1995


● Version 3.19: End of 1996, from www.tcx.se
● Version 3.20: January 1997
● Windows version was released on 8 January 1998 for Windows 95 and NT
● Version 3.21: production release 1998, from www.mysql.com
● Version 3.22: alpha, beta from 1998
● Version 3.23: beta from June 2000, production release 22 January 2001[23]
● Version 4.0: beta from August 2002, production release March 2003 (unions).
● Version 4.1: beta from June 2004, production release October 2004
(R-trees and B-trees, subqueries, prepared statements).
● Version 5.0: beta from March 2005, production release October 2005 (cursors, stored
procedures, triggers, views, XA transactions).
● Sun Microsystems acquired MySQL AB in 2008.
● Version 5.1: production release 27 November 2008 (event scheduler, partitioning,
plugin API, row-based replication, server log tables)
MySQL 5.1 and 6.0-alpha showed poor performance when used for data
warehousing – partly due to its inability to utilize multiple CPU cores for processing
a single query.
● Oracle acquired Sun Microsystems on 27 January 2010.[29][30][31]
● MySQL Server 5.5 was generally available (as of December 2010). Enhancements
and features include:

o The default storage engine is InnoDB, which supports transactions and


referential integrity constraints.
o Improved InnoDB I/O subsystem
o Semisynchronous replication.
o New options for user-defined partitioning.
● MySQL Server 6.0.11-alpha was announced on 22 May 2009 as the last release of the
6.0 line. Future MySQL Server development uses a New Release Model. Features
developed for 6.0 are being incorporated into future releases.
● The general availability of MySQL 5.6 was announced in February 2013. New
features included performance improvements to the query optimizer, higher
transactional throughput in InnoDB, new NoSQL-style mem cached APIs,
improvements to partitioning for querying and managing very large
tables, TIMESTAMP column type that correctly stores milliseconds, improvements to
replication. The InnoDB storage engine also included support for full-text search and
improved group commit performance.
● The general availability of MySQL 5.7 was announced in October 2015. As of MySQL
5.7.8, August 2015, MySQL supports a native JSON data type defined by RFC 7159.
● MySQL Server 8.0 was announced in April 2018, including NoSQL Document Store,
atomic and crash safe DDL sentences and JSON Extended syntax, new functions, such as
JSON table functions, improved sorting, and partial updates.

1.5 Features of PHP & MySQL

1. Cost

PHP is one of the “P’s” in the popular LAMP stack. The LAMP stack refers to the
popular combination of Linux, Apache, MySQL, and PHP/Perl/Python that runs many
web sites and powers many web applications.

Many of the components of the LAMP stack are free, and PHP is no exception. PHP
is free, as in there is no cost to develop in and run programs made with PHP.

Though MySQL’s license and costs have changed, you can obtain the Community
Server edition for free. MySQL offers several levels of support contracts for their
database server. More information can be obtained at www.mysql.com.

Both PHP and MySQL run on a variety of platforms, including many variants of Linux,
Microsoft Windows, and others. Running on an operating system such as Linux gives
the opportunity for a completely free web application platform, with no up-front costs.

Of course, when talking about software development and application platforms, the
up-front cost of software licensing is only a portion of the total cost of ownership
(TCO). Years of real-world experience with Linux, Apache, MySQL, and PHP in
production environments has proved that the total cost of maintaining these
platforms is lower, many times much lower, than maintaining an infrastructure with
proprietary, non-free software.
2. Ease of Use
When compared to many other programming languages, PHP make it easy to develop
powerful web applications quickly. Many of the most useful specific functions (such as
those for opening a connection to an Oracle database or fetching e-mail from an
Internet Message Access Protocol [IMAP] server) are predefined for you. A lot of
complete scripts are waiting out there for you to look at as you’re learning PHP.

Most advanced PHP users (including most of the development team members) are
diehard handcoders. They tend to share certain gut-level, subcultural assumptions —
for instance, that handwritten code is beautiful and clean and maximally
browser-compatible and therefore the only way to go .

The PHP community offers help and trades tips mostly by e-mail, and if you want to
participate, you have to be able to parse plain-text source code with facility. Some
WYSIWYG users occasionally ask list members to diagnose their problems by looking at
their web pages instead of their source code, but this rarely ends well.

That said, let us reiterate that PHP really is easy to learn and write, especially for those
with a little bit of experience in a C-syntaxes programming language. It’s just a little
more involved than HTML. This small learning curve means that relatively
inexperienced programmers can sometimes make mistakes that turn into large security
issues.

If you have no relational database experience, or are coming from an environment such
as Microsoft Access, MySQL’s command-line interface and lack of implicit structure may
at first seem a little daunting. MySQL has a few GUI (graphical user interface) tools to
help work with databases.

3. HTML-embeddedness
The HTML-embeddedness of PHP has many helpful consequences:

PHP can quickly be added to code produced by WYSIWYG editors

.■ PHP lends itself to a division of labor between designers and programmers.

■Every line of HTML does not need to be rewritten in a programming language

.■ PHP can reduce labor costs and increase efficiency because of its shallow learning
curve and ease of use.
4. Cross-platform compatibility
PHP and MySQL run native on every popular flavor of Linux/Unix (including Mac OS X)
and Microsoft Windows. A huge percentage of the world’s Hypertext Transfer Protocol
(HTTP) servers run on one of these two classes of operating systems.

PHP is compatible with the leading web servers: Apache HTTP Server for Linux/Unix
and Windows and Microsoft Internet Information Server. It also works with several
lesser-known servers. Specific web server compatibility with MySQL is not required,
since PHP will handle all the dirty work for you.

5. Stability
The word stable means two different things in this context:

The server doesn’t need to be rebooted or restarted often.

The software doesn’t change radically and incompatibly from release to release.

To our advantage, both of these connotations apply to both MySQL and PHP.

Apache Server is generally considered the most stable of major web servers, with a
reputation for enviable uptime percentages. Most often, a server reboot isn’t required
for each setting change. PHP inherits this reliability; plus, its own implementation is
solid yet lightweight.

PHP and MySQL are also both stable in the sense of feature stability. Their respective
development teams have thus far enjoyed a clear vision of their project and refused to
be distracted by every new fad and ill-thought-out user demand that comes along.
Much of the effort goes into incremental performance improvements, communicating
with more major databases, or adding better OOP support. In the case of MySQL, the
addition of reasonable and expected new features has hit a rapid clip. For both PHP and
MySQL, such improvements have rarely come at the expense of compatibility.

6. Many extensions
PHP makes it easy to communicate with other programs and protocols. The PHP
development team seems committed to providing maximum flexibility to the largest
number of users.

Database connectivity is especially strong, with native-driver support for about 15 of


the most popular databases plus Open DataBase Connectivity (ODBC). In addition, PHP
supports a large number of major protocols such as POP3, IMAP, and LDAP. Earlier
versions of PHP added support for Java and distributed object architectures
(Component Object Model [COM] and Common Object Request Broker Architecture
[CORBA]), making n-tier development a possibility for the first time, fully incorporated
GD graphics library and revamped Extensible Markup Language (XML) support with
DOM and simpleXML.

7. Fast feature development


Users of proprietary web development technologies can sometimes be frustrated by
the glacial speed at which new features are added to the official product standard to
support emerging technologies. With PHP, this is not a problem. All it takes is one
developer, a C compiler, and a dream to add important new functionality. This is not to
say that the PHP team will accept every random contribution into the official
distribution without community buy-in, but independent developers can and do
distribute their own extensions that may later be folded into the main PHP package in
more or less unitary form. For instance, Dan Libby’s elegant xmlrpc-epi extension was
adopted as part of the PHP distribution in version 4.1, a few months after it was first
released as an independent package.

PHP development is also constant and ongoing. Although there are clearly major
inflection points, such as the transition between PHP4 and PHP5, these tend to be most
important deep in the guts of the parser — people were actually working on major
extensions throughout the transition period without critical problems. Furthermore,
the PHP group subscribes to the open source philosophy of “release early, release
often,” which gives developers many opportunities to follow along with changes and
report bugs.

8. Not proprietary
The history of the personal computer industry to date has largely been a chronicle of
proprietary standards: attempts to establish them, clashes between them, their
benefits and drawbacks for the consumer, and how they are eventually replaced with
new standards.

The past few years the Internet has demonstrated the great convenience of voluntary,
standardsbased, platform-independent compatibility. E-mail, for example, works so
well because it enjoys a clear, firm standard to which every program on every platform
must conform. New developments that break with the standard (for example,
HTML-based e-mail stationery) are generally regarded as deviations, and their users
find themselves having to bear the burdens of early adoption.
Furthermore, customers (especially the big-fish businesses with large systems) are fed
up with spending vast sums to conform to a proprietary standard only to have the
market uptake not turn out as promised. Much of the current momentum toward XML
and web services is driven by years of customer disappointment with Java RMI
(Remote Method Invocation), CORBA, COM, and even older proprietary methods and
data formats.

Right now, software developers are in a period of experimentation and flux concerning
proprietary versus open standards. Companies want to be sure that they can maintain
profitability while adopting open standards. There have been some major legal
conflicts related to proprietary standards, which are still being resolved. These could
eventually result in mandated changes to the codebase itself or even affect the futures
of the companies involved. In the face of all this uncertainty, a growing number of
businesses are attracted to solutions that they know will not have these problems in
the foreseeable future.

PHP is in a position of maximum flexibility because it is, so to speak, antiproprietary. It


is not tied to any one server operating system, unlike Active Server Pages. It is not tied
to any proprietary cross-platform standard or middleware, as is Java Server Pages or
ColdFusion. It is not tied to any one browser or implementation of a programming
language or database. PHP isn’t even doctrinaire about working only with other open
source software. This independent but cooperative pragmatism should help PHP ride
out the stormy seas that seem to lie ahead.

9. Strong user communities


PHP is developed and supported in a collaborative fashion by a worldwide community
of users. Some animals (such as the core developers) are more equal than others, but
that’s hard to argue with, because they put in the most work, had the best ideas, and
have managed to maintain civil relationships with the greatest number of other users.

The main advantage for most new users is technical support without charge, without
boundaries, and without the runaround. People on the mailing list are available 24/7 to
answer your questions, help debug your code, and listen to your gripes. The support is
human and real. PHP community members might tell you to read the manual, take your
question over to the appropriate database mailing list, or just stop your whining —
but they’ll never tell you to wipe your C drive and then charge you for the privilege.
Often, they’ll look at your code and tell you what you’re doing wrong or even help you
design an application from the ground up.

As you become more comfortable with PHP, you may wish to contribute. Bug tracking,
offering advice to others on the mailing lists, posting scripts to public repositories,
editing documentation, and, of course, writing C code are all ways you can give back to
the community.

1.2 Introduction to Apache Web Server

Web server is a computer where the web content is stored. Basically web
server is used to hostthe web sites but there exists other web servers also
such as gaming, storage, FTP, email etc.Web site is collection of web pages
whileweb server is a software that respond to therequest for web resources.

Web Server Working

Web server respond to the client request in either of the following two
ways:Sending the file to the client associated with the requested
URL.Generating response by invoking a script and communicating with
database.
How Does Apache Web Server Work?

Although we call Apache a web server, it is not a physical server, but rather a software that
runs on an HTTP server. Its job is to establish a connection between a server and the
browsers of website visitors (Firefox, Google Chrome, Safari, etc.) while delivering files back
and forth between them (client-server structure). The Apache software is also compatible
with any operating system, from Windows to Unix.
When a visitor wants to load a page on your website, for instance, the homepage or your
“About Us” page, their browser sends a request to your server, and Apache returns a
response with all the requested files (text, images, etc.).

The server and the client communicate through the HTTP protocol, and the Apache web
server is responsible for the smooth and secure communication between the two machines.

Apache is highly customizable, thanks to its open-source infrastructure. Due to this, web
developers and users can adapt its source code according to the type of website they’re
creating.

In addition, Apache provides plenty of modules that allow server administrators to turn
additional functionalities on and off. The Apache web server has modules for security,
caching, URL rewriting, password authentication, and other features.

Apache Pros and Cons


An Apache web server can be an excellent choice to run your website on a stable and
versatile platform. However, it also comes with some disadvantages you need to pay
attention to.

Pros:

1. Open-source and free, even for commercial use.


2. Reliable, stable software.
3. Frequently updated security patches.
4. Flexible due to its module-based structure.
5. Easy to configure, beginner-friendly.
6. Cross-platform (works on both Unix and Windows servers).
7. Optimal deliverability for static files and compatibility with any programming
language (PHP, Python, etc)
8. Works out of the box with WordPress sites.
9. Huge community and easily available support in case of any problem.

Cons:

1. Performance problems on extremely traffic-heavy websites.


2. Too many configuration options can lead to security vulnerabilities.
1.3 Relationship between Apache, MySQL and PHP, Installation Of
PHP(WAMP or XAMPP server or any latest server)

AMP Module in PHP Stand for Apache, MySQL, and PHP. AMP module in PHP is can be
characterized into three component Apache MySQL, and PHP.

Below figure shows the relationship between the Apache, MySQL, and PHP.

Apache

● In AMP module, Apache act as a web server on which your web application are hosted.
● Its main job is to parse the file which requested by the web browser and display correct
result according to the code within that file.
PHP

● PHP stands for Hypertext Preprocessor.


● PHP is a widely-used open source server-side scripting language.
● Using PHP user can built a dynamic web application that host on the apache web server.

MySQL
● MySQL is the relational database management system.
● MySQL is the database that required when we want to create dynamic web application.
● In MySQL database the data stored in tabular form.
● MySQL enables PHP and Apache to work together to access and display data in a
readable format to a web browser.

How Its Work?

● First user request for the web page through the web browser.
● If the requested page is found on the server then the server will process on that page and
execute the scripting code(PHP code).

After the execution of the scripting code(PHP code), the server sends the output to the user in
the form of HTML.

The users browser process on this page that send by the web server and display to the user.

Installation Of PHP(WAMP or XAMPP server or any latest server)


XAMPP is the title used for a compilation of free software. The name is an acronym, with each letter

representing one of the five key components. The software packet contains the web server Apache,

the relational database management system MySQL (or MariaDB), and the scripting languages Perl

and PHP. The initial X stands for the operating systems that it works with: Linux, Windows, and Mac

OS X.

● Apache: ihe open source web server Apache is the most widely used server worldwide for
delivery of web content. The server application is made available as a free software by the
Apache Software Foundation.
● MySQL/MariaDB: in MySQL, XAMPP contains one of the most popular relational database
management systems in the world. In combination with the web server Apache and the
scripting language PHP, MySQL offers data storage for web services. Current XAMPP
versions have replaced MySQL with MariaDB (a community-developed fork of the MySQL
project, made by the original developers).
● PHP: the server-side programming language PHP enables users to create dynamic websites
or applications. PHP can be installed on all platforms and supports a number of diverse
database systems.
● Perl: the scripting language Perl is used in system administration, web development, and
network programming. Like PHP, Perl also enables users to program dynamic web
applications.

Alongside these core components, this free-to-use Apache distribution contains some other useful

tools, which vary depending on your operating system. These tools include the mail server Mercury,

the database administration tool phpMyAdmin, the web analytics software solutions Webalizer,

OpenSSL, and Apache Tomcat, and the FTP servers FileZilla or ProFTPd.

Installing XAMPP

1. The XAMPP Control Panel


2. Testing your XAMPP installation

Application areas

An XAMPP server can be installed and used with a single executable file quickly and easily,

functioning as a local test system for Linux, Windows, and Mac OS X. The software packet

contains the same components that are found on common web servers. Developers have the

chance to test out their projects locally and to transfer them easily to productive systems.

But XAMPP isn’t suitable to use as a public server, because many safety features have been

deliberately left out to simplify and speed up the system for testing.

Tip
You need a server for your web project? With IONOS you can easily rent your server online.

From virtual servers for middle to large-sized projects, to cloud servers for optimal flexibility

as well as dedicated servers for particularly complex requirements. Check out the range!

Installing XAMPP

Our XAMPP tutorial will take you through the installation process for the software package on

Windows. If you’re using Linux or Mac OS X, then the steps listed below for the installation

process may differ.

Step 1: Download
XAMPP is a release made available by the non-profit project Apache Friends. Versions with

PHP 5.5, 5.6, or 7 are available for download on the Apache Friends website.

Step 2: Run .exe file


Once the software bundle has been downloaded, you can start the installation by double

clicking on the file with the ending .exe.

Step 3: Deactivate any antivirus software


Since an active antivirus program can negatively affect the installation process, it’s

recommended to temporarily pause any antivirus software until all XAMPP components have

successfully been installed.


Before
installing XAMPP, it is advisable to disable the anti-virus program temporarily

Step 4: Deactivate UAC


User Account Control (UAC) can interfere with the XAMPP installation because it limits

writing access to the C: drive, so we recommend you deactivate this too for the duration of

the installation process. To find out how to turn off your UAC, head to the Microsoft Windows

support pages.

User
account control can affect the installation of XAMPP

Step 5: Start the setup wizard


After you’ve opened the .exe file (after deactivating your antivirus program(s) and taken note

of the User Account Control, the start screen of the XAMPP setup wizard should appear

automatically. Click on ‘Next’ to configure the installation settings.


You can
start the setup on the startup screen

Step 6: Choose software components


Under ‘Select Components’, you have the option to exclude individual components of the

XAMPP software bundle from the installation. But for a full local test server, we recommend

you install using the standard setup and all available components. After making your choice,

click ‘Next’.
In the
dialog window entitled 'select components', you can choose the software components before
installation

Step 7: Choose the installation directory


In this next step, you have the chance to choose where you’d like the XAMPP software packet

to be installed. If you opt for the standard setup, then a folder with the name XAMPP will be

created under C:\ for you. After you’ve chosen a location, click ‘Next’.
For the
next step, you need to select the directory where XAMPP should be installed

Step 8: Start the installation process


Once all the aforementioned preferences have been decided, click to start the installation.

The setup wizard will unpack and install the selected components and save them to the

designated directory. This process can take several minutes in total. You can follow the

progress of this installation by keeping an eye on the green loading bar in the middle of the

screen.
According to the default settings, the selected software components are unpacked and installed
in the target folder

Step 9: Windows Firewall blocking


Your Firewall may interrupt the installation process to block the some components of the

XAMPP. Use the corresponding check box to enable communication between the Apache

server and your private network or work network. Remember that making your XAMPP server

available for public networks isn’t recommended.

Step 10: Complete installation


Once all the components are unpacked and installed, you can close the setup wizard by

clicking on ‘Finish’. Click to tick the corresponding check box and open the XAMPP Control

Panel once the installation process is finished.


By
clicking on 'finish', the XAMPP Setup Wizard is completed

The XAMPP Control Panel

Controls for the individual components of your test server can be reached through the

XAMPP Control Panel. The clear user interface logs all actions and allows you to start or stop

individual modules with a single. The XAMPP Control Panel also offers you various other

buttons, including:

● Config: allows you to configure the XAMPP as well as the individual components
● Netstat: shows all running processes on the local computer
● Shell: opens a UNIX shell
● Explorer: opens the XAMPP folder in Windows Explorer
● Services: shows all services currently running in the background
● Help: offers links to user forums
● Quit: closes the XAMPP Control Panel

In the Control Panel, you can start and stop individual modules

Starting modules
Individual modules can be started or stopped on the XAMPP Control Panel through the

corresponding buttons under ‘Actions’. You can see which modules have been started

because their names are highlighted green under the ‘Module’ title.
An active module is marked in green in the Control Panel

If a module can’t be started as a result of an error, you’ll be informed of this straight away in

red font. A detailed error report can help you identify the cause of the issue.

Setting up XAMPP
A common source of error connected with Apache is blocked ports. If you’re using the

standard setup, then XAMPP will assign the web server to main port 80 and the SSL port 443.

The latter of these particularly is often blocked by other programs. In the example above, it’s

likely that the Tomcat port is being blocked, meaning the web server can’t be started. There

are three ways to solve this issue:

● Change the conflicting port: Let’s assume for the sake of example that the instant
messenger program Skype is blocking SSL port 443 (this is a common problem). One
way to deal with this issue is to change Skype’s port settings. To do this, open the
program and navigate via ‘Actions’, ‘Options’, and ‘Advanced’, until you reach the
‘Connections’ menu. You should find a box checked to allow Skype access to ports 80
and 443. Deselect this checkbox now.
● Change the XAMPP module port settings: Click the Config button for the module in
question and open the files httpd.conf and httpd-ssl.conf. Replace port number 80 in
httpd.conf and port number 443 in httpd-ssl.conf with any free ports, before saving the
file data. Now click on the general Config button on the right-hand side and select
‘Services and Ports Settings’. Customize the ports for the module server to reflect the
changes in the conf files.

Modules that can’t be started will be shown in red. The user will also receive an error report to
help solve the problem

Module administration
You have an ‘Admin’ option located on the Control Panel for every module in your XAMPP.

● Click on the Admin button of your Apache server to go to the web address of your
web server. The Control Panel will now start in your standard browser, and you’ll be
led to the dashboard of your XAMPP’s local host. The dashboard features numerous
links to websites for useful information as well as the open source project BitNami,
which offers you many different applications for your XAMPP, like WordPress or other
content management systems. Alternatively, you can reach the dashboard through
localhost/dashboard/.

By clicking on the 'admin' button of the Apache module, the user will be redirected to the local
dashboard of XAMPP

● You can use the Admin button of your database module to open phpMyAdmin. Here,
you can manage the databases of your web projects that you’re testing on your
XAMPP. Alternatively, you can reach the administration section of your MySQL
database via localhost/phpmyadmin/.
The web project’s databases are managed by the user in phpMyAdmin (accessible via the 'Admin'
button in the database module)

Testing your XAMPP installation

To check whether your test server is installed and configured correctly, you have the option

to create a PHP test page, store them on your XAMPP’s local host, and retrieve them via the

web browser.

● Open the XAMPP directory through the ‘Explorer’ button in the Control Panel and
choose the folder htdocs (C:\xampp\htdocs for standard installations). This directory
will store file data collected for web pages that you test on your XAMPP server. The
htdocs folder should already contain data to help configuration of the web server. But
you should store your own projects in a new folder (like ‘Test Folder’ for example).
● You can create a new PHP page easily by using the following content in your editor
and storing it as test.php in your ‘ test’ folder (C:\xampp\htdocs\test):

<html>

<head>

<title>PHP-Test</title>
</head>

<body>

<?php echo '<p>Hello World</p>'; ?>

</body>

</html>

● The last step now is to open your web browser and load your PHP page via
localhost/test/test.php. If your browser window displays the words ‘Hello World’, then
you’ve successfully installed and configured your XAMPP.

Install Linux, Apache, MySQL, PHP


(LAMP) Stack on Ubuntu 22.04
A “LAMP” stack is a group of open source software that is typically installed together in
order to enable a server to host dynamic websites and web apps written in PHP. This
term is an acronym which represents the Linux operating system with the Apache web
server. The site data is stored in a MySQL database, and dynamic content is processed
by PHP.

In this guide, you’ll set up a LAMP stack on an Ubuntu 22.04 server.

Step 1 — Installing Apache and Updating the Firewall

The Apache web server is among the most popular web servers in the world. It’s well
documented, has an active community of users, and has been in wide use for much of
the history of the web, which makes it a great choice for hosting a website.

Start by updating the package manager cache. If this is the first time you’re using sudo
within this session, you’ll be prompted to provide your user’s password to confirm you
have the right privileges to manage system packages with apt:

sudo apt update


Then, install Apache with:

sudo apt install apache2

You’ll be prompted to confirm Apache’s installation. Confirm by pressing Y, then


ENTER.

You can do a spot check right away to verify that everything went as planned by visiting
your server’s public IP address in your web browser (view the note under the next
heading to find out what your public IP address is if you do not have this information
already):

http://your_server_ip

The default Ubuntu 22.04 Apache web page is there for informational and testing
purposes. Below is an example of the Apache default web page:
If you can view this page, your web server is correctly installed and accessible
through your firewall.
Step 2 — Installing MySQL

Now that you have a web server up and running, you need to install the database
system to be able to store and manage data for your site. MySQL is a popular
database management system used within PHP environments.

Again, use apt to acquire and install this software:

sudo apt install mysql-server

When prompted, confirm installation by typing Y, and then ENTER.

When you’re finished, test whether you’re able to log in to the MySQL console by
typing:

sudo mysql

To exit the MySQL console, type:

Exit

Step 3 — Installing PHP

You have Apache installed to serve your content and MySQL installed to store and
manage your data. PHP is the component of our setup that will process code to display
dynamic content to the final user. In addition to the php package, you’ll need php-mysql,
a PHP module that allows PHP to communicate with MySQL-based databases. You’ll
also need libapache2-mod-php to enable Apache to handle PHP files. Core PHP
packages will automatically be installed as dependencies.

To install these packages, run the following command:

sudo apt install php libapache2-mod-php php-mysql


1.

Copy

Once the installation is finished, run the following command to confirm your PHP
version:

php -v

1.

Copy

Output

PHP 8.1.2 (cli) (built: Mar 4 2022 18:13:46) (NTS)

Copyright (c) The PHP Group

Zend Engine v4.1.2, Copyright (c) Zend Technologies

with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

Apache on Ubuntu 22.04 has one virtual host enabled by default that is configured to
serve documents from the /var/www/html directory.
Additional points

What Does PHP Do?


PHP does anything you want, except sit on its head and spin. Actually, with a little
on-the-fly image manipulation and dynamic HTML, it could probably do that, too.

According to the PHP manual, “The goal of the language is to allow Web developers to
write dynamically generated pages quickly.”

Here are some common uses of PHP, all of which are a part of what you’ll learn in this
book:

• Perform system functions: create, open, read from, write to, and close files on your
system; execute system commands; create directories; and modify permissions.

• Gather data from forms: save the data to a file, send data via e-mail, and return
manipulated data to the user.

• Access databases and generate content on the fly, or create a Web interface for adding,
deleting, and modifying elements within your database.

• Set cookies and access cookie variables.

• Start sessions and use session variables and objects.

• Restrict access to sections of your Web site.

• Create images on the fly.

• Encrypt data.

You might also like