You are on page 1of 5

ARELLANO UNIVERSITY – PLARIDEL CAMPUS

53 General Kalentong St. Mandaluyong


Senior High School
Dynamic Learning Program

Name: Date:
Grade/Section: Rating:
Teacher:

SUBJECT Computer Programming IV


TOPIC INTRODUCTION TO PHP
REFERENCE  https://www.w3schools.com/php/default.asp
 https://www.tutorialspoint.com/php/index.htm

OBJECTIVES At the end of the lesson, students should be able to;


a. Know the history of PHP programming language;
b. Understand the use of PHP;
c. Install all the necessary tools needed in creating a website;
d. Familiarize the basic syntax of PHP programming language;

CONCEPTS
PHP
- PHP (recursive acronym for PHP: Hypertext Preprocessor) is widely used
open source general-purpose scripting language that is especially suited for
web development and can be embedded into HTML.

Brief History of PHP


- PHP development began in 1994 when Rasmus Lerdorf wrote several
common gateway (CGI) program in C, which he used to maintain his personal
homepage. He extended them to work with web forms and communicate
with database.
- June 1995, Rasmus released the source code for PHP Tools to the public.
- September 1995, Rasmus expanded upon PHP and for a short tome actually
dropped the PHP name. Now referring to the tools as FI (Forms Interpreter).
- October 1995, Rasmus released a complete rewrite of the code. Bringing
back the PHP name, it was now briefly named “Personal Home Page
Construction Kit”.
- April 1996, combining the names of past releases, Rasmus introduced
PHP/FI.
- June 1996, PHP/FI was given a version 2.0 status.
- November 1997, finally graduated from beta status.
- 1997 and 1998, PHP/FI had a cult of several thousand users around the
world.
ARELLANO UNIVERSITY – PLARIDEL CAMPUS
53 General Kalentong St. Mandaluyong
Senior High School
Dynamic Learning Program

- May 1998, A Netcraft survey indicated that nearly 60,000 domains reported
having headers containing “PHP”.
WHAT DO WE NEED?
FOR PC
 LOCAL SERVER (XAMPP)
1. How to Install XAMPP
1. Open your browser and type XAMPP
2. Click XAMPP Installers and Downloads for Apache Friends
3. Choose XAMPP version base of the OS of your PC (Windows, Linux, OS X)
4. After downloading, locate the file and install it. Double click and run as
administrator.
5. A pop-up window for set up will appear, click next, next … and select allow
access if there a pop out window appear. Wait until installation finished.
6. After the installation, open the XAMPP control panel by searching it and run
it as administrator.
7. On the XAMPP control panel, start the Apache and MySQL
8. You can start coding
 VISUAL STUDIO CODE (ANY TEXT EDITOR)
How to Install Visual Studio Code
1. Open your browser and type code.visualstudio.com
2. Click download
3. After downloading the installer, locate the file location and install it.

FOR MOBILE PHONE


 KSWEB – Local Server for Mobile Phone
 DROIDEDIT – Text Editor

Note: Do not download the KSWEB on the app store because it is not free. Open
your browser and download the MOD apk. Type KSWEB mod apk.

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
?>
ARELLANO UNIVERSITY – PLARIDEL CAMPUS
53 General Kalentong St. Mandaluyong
Senior High School
Dynamic Learning Program

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

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

Example
<!DOCTYPE html>
<html>
<body>

<h1>My first PHP page</h1>

<?php
echo "Hello World!";
?>

</body>
</html>

Creating PHP Program Using Computer


1. After writing the code, save your file in the Web directory folder of your
server. Web directory folder: C:/xampp/htdocs
2. Save the file as PHP. Your file must have a .php extension.
3. To run the program, open your browser and type localhost/name of file.

Creating PHP Program Using Mobile Phone


1. Open the KSWEB on your mobile phone
2. Make sure that the APACHE is on.
3. Open your browser and type localhost:8080
4. After writing the code in DroidEdit, save the file in web directory htdocs.
5. Open your browser and type localhost:8080/name of the file

QUESTIONS/ACTIVITY QUESTIONS:
1. What does PHP mean? Hypertext Preprocessor
2. What is the local server used in PC?XAMPP
3. Where do we find the htdocs folder? C:/xampp/htdocs
4. How does PHP code start? <?php
5. How does PHP code ends? ?>

ANALYSIS Let the students answer the questions.


ARELLANO UNIVERSITY – PLARIDEL CAMPUS
53 General Kalentong St. Mandaluyong
Senior High School
Dynamic Learning Program

ASSESSMENT/
APPLICATION 1. Enumerate the Advantages and Disadvantages of PHP programming
language

Open Source and Free of Cost: One of the most vital advantages of PHP is
that it is accessible to all. People can download it from an open-source and
get it for free. One can download it anywhere and readily use it for web
application development.

Platform Independence: Another important factor is that since PHP-based


applications can run on any OS such as UNIX, Windows, Linux, etc., people
can use it without worrying about a platform where one can use it.

Easy loading: One can load the PHP-based applications easily and connect
them to a database. People mainly use it since it has a fast rate of loading
even if it is over a slow internet connection and speed than other
programming languages.

User-friendly: It has a less learning curve, and one can learn it quickly. The
language is straightforward to use, and if one knows about C programming,
they can catch on to PHP language quickly for application development.

Stable: Unlike other scripting languages, PHP is very stable over the years
and can provide one with assistance and continuous support. They can get
help over various versions as well.

2. Give 5 website that uses PHP.


WordPress.
Tumblr.
MailChimp.
Flickr.
Digg.

Prepared by: Mr. John Louie M. Miguel


Teacher

Checked by: Mr. Ace Bhyron Cancino


ICT- Coordinator

Noted by: Mr. Janno H. Vizco


Academic Coordinator
ARELLANO UNIVERSITY – PLARIDEL CAMPUS
53 General Kalentong St. Mandaluyong
Senior High School
Dynamic Learning Program

Mrs. Junna C. Bulay


Assistant Principal

Approved by: Mrs. Vilma S. Dominguez


Principal

You might also like