PHP-and-MySQL/C2/XAMPP-in-Linux/English

From Script | Spoken-Tutorial
Revision as of 17:58, 3 March 2015 by Nancyvarkey (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Title of script: XAMPP Installation on Linux

Author: Kavita Kharad. (Modified from original script by Shahid Farooqui)

Keywords: XAMPP Video Tutorial, Apache, LAMPP, Web Server

Visual cue Narration
Slide Number 1

Title Slide

Hello everyone.

Welcome to this tutorial on XAMPP Installation on Linux.

Slide Number 2

Learning Objectives

In this tutorial, we will learn
  • How to install XAMPP on Linux
  • How to create & run a php file
Slide Number 3

System Requirement

To record this tutorial I am using
  • Ubuntu Linux OS 14.04
  • FireFox Web Browser and
  • Gedit Text editor
Slide Number 4

Pre-requisites

To install XAMPP, you should have-
  • A working Internet connection and
  • Admin access to your computer


You should also have basic knowledge of Linux commands.


If not, for relevant tutorials, please visit our website.

Slide Number 5 XAMPP is a Free and Open Source web server package.
Slide Number 6 XAMPP consists of,
  • Apache HTTP Server
  • MySQL database
  • Interpreters for scripts written in PHP and Perl
Slide Number 7 XAMPP is easy to install.


It is available for GNU/Linux, Mac, Windows and Solaris operating systems.

Switch to the website.

Type

ml

Let's download XAMPP for Linux.

Open the web browser on your machine.

In the Address bar, type

https://www.apachefriends.org/download.html

and press Enter.

Point to the various links.

Point to XAMPP-LINUX link .

Scroll down the page.

Here XAMPP is available to download for all operating systems.


Visit XAMPP for Linux section.

You can see the recent version of Xampp.

Point to the version 1.8.3 / PHP 5.5.19 and click on Download(64 bit). My system is a 64bit OS.

Under version 1.8.3 / PHP 5.5.19.

I will select Download(64 bit).


The download will start.

I have already downloaded this file in my Downloads Folder.

So I will skip downloading step.

Open Terminal. Now open the terminal.
In the terminal window, type

cd Downloads >> press Enter.

On the terminal, type the command

cd space Downloads

and press Enter.

This will change the current working directory to Downloads.

Type

ls >> press Enter.

Point to xampp-linux-x64-5.5.19-0-installer.run file

Now, type the command

ls

and press Enter.

This will display the contents of the Downloads folder.

Here is our XAMPP installation file.

Type

chmod +x xampp-linux-x64-5.5.19-0-installer.run

>> press Enter

Let's give executable permission to the file.

So that we can run this file.

Type chmod +x filename

and press Enter.

Type

sudo ./xampp-linux-x64-5.5.19-0-installer.run

>>press Enter.

Now to run the file, type

sudo ./ filename

and press Enter.

Enter the admin password if required.

Click on Next. Setup wizard dialog box opens.

Click on Next button whenever required and follow the installation steps as shown.

Uncheck Learn more about Bitnami for XAMPP check box >> Click on Next. Uncheck Learn more about Bitnami for XAMPP check box.

Click on Next.

Uncheck Launch XAMPP check box >> Click on Finish. Once the installation done, uncheck Launch XAMPP check box.

And click on Finish.

This installation will create lampp folder in the system's opt folder.
Click on Files Folder. Let's go there and have a look.

From the launcher on the left, click on Files folder icon.

Click on Computer. On the left panel, Under Devices section, click on Computer.
Open opt folder. You can see the system files.

Double-click on opt folder to open it.

Point to lampp folder >>

point to all folders.

Here it is- the lampp folder.

Open this folder.

Here we can see several sub-folders.

Point to htdocs folder. Locate the folder named htdocs.

This is our Web server Appache's root directory.

We have to save our PHP code files inside this folder to run it.

Slide Number 8

Apache's root directory

The Apache's root directory will be
  • /opt/lampp/htdocs or
  • /var/www

based on your installation process.

Type

sudo chmod 777 -R /opt/lampp/htdocs

>> press Enter.

To make htdocs folder writable, we have to change the permission.

So on the terminal, type

sudo chmod 777 -R /opt/lampp/htdocs

and press Enter.

Open Firefox

In the address bar type,

localhost

>> press Enter.

Now let's check whether Xampp is running or not.

Open the web browser.

In the Address bar, type localhost and press Enter.

It shows message “Unable to connect”.

In the terminal type,

sudo /opt/lampp/lampp start

>>press Enter.

It seems Xampp services are not running.

To start the services type on the terminal.

sudo /opt/lampp/lampp start

and press Enter.

This will start all the Xampp services.

Refresh web browser.

Select English Language.

Go back to the web browser and refresh the page.

Here it is! The welcome screen of Xampp.

It will ask us to choose the default language.

I will select English.

Xampp is running perfectly now.

Let's write a sample php code and run it.

Create new folder phpacademy. In htdocs let's create a folder named phpacademy.

In future, I will save all my php files in this folder.

This is to ensure that my files don't get over written by someone else.

Open phpacademy.

Create file demo.php.

Open the phpacademy folder.

Let us create a php file.

Right-click and select New Document and Empty document.

Name it as demo.php

Open demo.php file in gedit. Open the demo.php in Gedit text editor.

You can use any editor of your choice.

Type code

<?php

echo “Hello India”;

?>

Type:

less than question mark php

echo within double quotes "Hello India”;

question mark greater than

Press Ctrl+S To save the file press Ctrl and S keys simultaneously.
Switch to web browser

In the address bar type,

localhost/phpacademy

>>press Enter

Point to all the files.

Go back to the web browser.

In the address bar type

localhost/phpacademy

and press Enter.

Point to demo.php file.

Click on demo.php file.

Point to Hello India.

This will display the list of files inside the phpacademy folder.


Here is our file demo.php, Click on it .

Message “Hello India” is displayed.

Switch to terminal and type

sudo /opt/lampp/lampp stop

>>press Enter

To stop Xampp services, type on the terminal.

sudo /opt/lampp/lampp stop

and press Enter.


Enter the admin password if required.


XAMPP services will stop running.

Whenever you wish to run Xampp again in future, remember to start it first.

Slide Number 9

Summary

Let us summarise,

In this tutorial, we have learnt-

  • How to install, start and stop XAMPP services.
  • How to create and run a PHP file.
Slide Number 10

About Spoken Tutorial Project

This video summarises the Spoken Tutorial project.

If you do not have good bandwidth, you can download and watch it.

Slide Number 11

About Spoken Tutorial workshops

The Spoken Tutorial Project Team conducts workshops and gives certificates.

For details, please write to us.

Slide Number 12

Acknowledgement

Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.

More information on this Mission is available at the link shown.

This is Kavita Kharad from IIT Bombay signing off.

Thank you for joining.

Contributors and Content Editors

Chandrika, Kkkavita, Nancyvarkey, PoojaMoolya