WEB DEVELOPMENT
Practical 1:
a) Installation of XAMPP server.
Installing XAMPP on Ubuntu 22.04
Please follow the following steps to download, install and configure XAMPP on
your system:
Step 1: Download the installation package
The first step is to download the XAMPP package for Linux from the official
Apache Friends website: https://www.apachefriends.org/index.html
Click on the XAMPP for Linux option after which you will be prompted to Run
the package or Save it to your system. We recommend downloading the
Enrolment No: 202202100710143
WEB DEVELOPMENT
package by clicking the Save File option. After which, your downloaded file will
be saved to the Downloads folder by default.
Step 2: Make the installation package executable
We will install the package through the Ubuntu command line, The Terminal. In
order to open the Terminal, either use the Dash or the Ctrl+Alt+T shortcut. After
the Terminal is open, you need to move to your Downloads folder to access the
file.
Move to the Downloads folder by using the following command:
$ cd /home/[username]/Downloads
The installation package you downloaded needs to be made executable before
it can be used further. Run the following command for this purpose:
$ chmod 755
[package name]
Example:
$ chmod 755 xampp-linux-*-installer.run
Now the install package is in an executable form.
Step 3: Confirm execute permission
It is important to verify if the package can be executed by the current user. The
execute permission can be checked through the following command:
$ ls -l
[package
name:]
Example
:
$ ls -l xampp-linux-x64-8.1.12-0-installer.run
Enrolment No: 202202100710143
WEB DEVELOPMENT
The -rwxr output shows that the file can be executed by the user whose name is
also mentioned in the output.
Step 4: Launch the Setup Wizard
As a privileged root user, run the following command in order to launch the
graphical setup wizard.
$ sudo ./[package
name] Example: sudo
./xampp-linux-x648.1.12-
0-installer.run
This will launch the Setup wizard that will direct you with the rest of the
installation procedure.
Step 5: Work through the graphical setup wizard
Now that the Setup Wizard for XAMPP by Bitnami is launched as follows, click
the Next button to start the installation process:
The following dialog lets you choose XAMPP components that you want to
install.
Enrolment No: 202202100710143
WEB DEVELOPMENT
Keep the default settings intact and then click Next. The following dialog will
inform you about the location where XAMPP will be installed.
Click Next to begin the installation process:
Enrolment No: 202202100710143
WEB DEVELOPMENT
When the installation is complete, click the Next button. The following dialog
indicates the completion of the installation process.
Enrolment No: 202202100710143
WEB DEVELOPMENT
If you do not want to Launch XAMPP at this moment, uncheck the Launch
XAMPP option. Also, click Finish to close the Setup dialog.
Step 6: Launch XAMPP through the Terminal
In order to launch XAMPP through your Ubuntu Terminal, enter the following
command as root:
$ sudo /opt/lampp/lampp start
And the XAMPP control panel shows up.
Enrolment No: 202202100710143
WEB DEVELOPMENT
This output shows that XAMPP is started and already running. Please note that
you need to manually start XAMPP each time you restart your system.
If you get the following output after starting XAMPP, it means that Net Tools are
not installed on your system:
In order to install Net Tools, run the
following command as root: $ sudo apt
install net-tools
Enrolment No: 202202100710143
WEB DEVELOPMENT
After the installation of Net Tools, you will be successfully able to launch and
use XAMPP.
Step 7: Verify Installation
After you have installed XAMPP on your Ubuntu system, it is good practice to
verify the installation. To do so, enter the following URL in your Firefox browser:
http://localhost
Enrolment No: 202202100710143
WEB DEVELOPMENT
The following webpage verifies that XAMPP is successfully installed and running
on your system:
You can also verify the installation of phpMyAdmin in a similar manner by
entering the following URL in your browser: http://localhost/phpmyadmin The
following webpage verifies that phpMyAdmin is successfully installed and
running on your system:
Stop XAMPP Server
Use the following command to stop the XAMPP server from command
line: $ sudo /opt/lampp/ lampp start
Enrolment No: 202202100710143
WEB DEVELOPMENT
The result is:
Enrolment No: 202202100710143
WEB DEVELOPMENT
b) Write a PHP script to display “Hello World”.
Code:
<?php
echo "Hello world" ;
?>
Output:
Enrolment No: 202202100710143
WEB DEVELOPMENT
Practical 2:
Write a PHP script for following:
a) Find sum of first N numbers.
Code:
<?php
$sum=0;
for($i=1;$i<=10;$i++)
{
$sum=$sum+$i;
}
echo "Total sum is = ",$sum;
?>
Output:
Enrolment No: 202202100710143
WEB DEVELOPMENT
b) Print square value for the numbers between N1 to N2.
Code:
<?php
for($i=1;$i<=10;$i++){
$sum=$i+$i;
echo $i,"=",$sum,"<br>";
}
?>
Output:
Enrolment No: 202202100710143