0% found this document useful (0 votes)
44 views

I Am Sharing - Chapter 1 Introduction To PHP - With You

PHP is a server-side scripting language used to create dynamic web pages. It allows embedding scripts into web pages using the .php file extension. To test PHP scripts locally, one can install and configure a local development server like XAMPP. Creating a basic "Hello World" PHP page demonstrates a simple PHP echo statement to output dynamic text on the page. The document recommends using a code editor like Visual Studio Code to write and edit PHP files.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

I Am Sharing - Chapter 1 Introduction To PHP - With You

PHP is a server-side scripting language used to create dynamic web pages. It allows embedding scripts into web pages using the .php file extension. To test PHP scripts locally, one can install and configure a local development server like XAMPP. Creating a basic "Hello World" PHP page demonstrates a simple PHP echo statement to output dynamic text on the page. The document recommends using a code editor like Visual Studio Code to write and edit PHP files.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Chapter 1

Introduction to PHP
Introduction
• PHP is a server-side programming language that used to
create web pages run dynamically on the server before
sending them to the client.
• PHP is a solid, easy-to-learn, well-established language (it
was introduced in 1994).
• PHP can be used as object-oriented or procedural. PHP is
interpreted rather than compiled.
• HTTP is a communication standard governing the requests
and responses that take place between the browser running
on the end user’s computer and the web server.
2
Introduction (cont…)
• A web server can usually handle multiple simultaneous
connections and spends its time listening for an incoming
connections. When one arrives, the server sends back a
response to confirm its receipt.

3
The Request/Response Procedure

4
Dynamic Web Pages Procedure

5
• Although it’s helpful to be aware of this process so that you
know how the elements work together, in practice you don’t
really need to concern yourself with these details, because
they all happen automatically.

6
Using PHP
• PHP borrows a bit of its syntax from other languages such as
C and Java. It is really a hybrid language, taking the best
features from other languages and creating an easy-to-use
and powerful scripting language. With PHP, it’s a simple
matter to embed dynamic activity in web pages. When you
give pages the .php extension, they have instant access to
the scripting language.

7
PHP Page Structure
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home Page</title>
</head>
<body>
Hello world!!!
<?php
echo " Today is " . date("l") . ". ";
?>
</body>
</html>
8
Setting Up a Development Server
• You can use WAMP (stands for Windows Apache MySQL PHP)
or XAMPP (stands for X-OS Apache MySQL PHP Perl) server.
WAMP works only in Windows operating system, whereas
XAMPP is a cross-platform, it works in Windows, Linux, Mac
etc.
• The key difference between them apart from OS support is
security (WAMP was built with security in mind).
• You can download the preferred server for free from the
internet. Install the local server (we will use XAMPP in this
course) probably and test it.
9
Testing the Installation
• The first thing to do at this point is verify that everything is
working correctly.
• Enter either of the following two URLs into the address bar
of your browser: Localhost or 127.0.0.1
• Note that, if you chose a server port other than 80, for
example, 8080, then you must place a colon followed by that
value after either of the preceding URLs—like this:
localhost:8080. You will have to do the same for all examples:
localhost:8080/example.php

10
Accessing the Document Root
The document root is the one that is entered when a basic
URL without a path is typed into a browser, such as
http://yahoo.com or, for your local server, http://localhost.
By default, XAMPP uses the following location for this
directory:
C://xampp/htdocs

11
First Page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home Page</title>
</head>
<body>
Hello world!!!
<?php
echo (" Today is " . date("l") . ".");
?>
</body>
</html>
12
First Page (cont…)
• Save the file into the root directory (C://xampp/htdocs) using
the filename test.php.
• You can now call this page up in your browser by entering
one of the following URLs (according to the extension you
used) in its address bar.
http://localhost/test.php

13
Using a Program Editor
• There are a number of good program editors available such
as Notepad, Editra, Notepad++, Sublime, phpDesigner,
Visual Studio Code etc. An integrated development
environments (IDEs) offer many additional features such as
in-editor debugging and program testing, as well as function
descriptions and much more.
• We will use Visual Studio Code for this course.

14
END
15

You might also like