Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
Introduction
to PHP
Norjan S. Eneria, MIT
Instructor 1
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
Course Description
This course introduces the student to dynamic web page
development using the PHP programming language and the
popular MySQL open source database management software
(DBMS). Students will gain XAMPP development experience
using the Windows operating system, and the Apache web
server platform. Students will learn how PHP works, how to
effectively use many of its powerful extensions, and how to
design and build their own PHP web applications.
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
Outline of the topic
• Open Source
• Static vs. Dynamic Web Sites
• What is HTTP?
• What is PHP?
• What does a PHP script look like?
• PHP Functions
• PHP and HTML
• MySQL
• Debbugging
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
Before we continue..
• HTML
• CSS
• JavaScript
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
Setting up the environment
• To set up a PHP environment using Visual Studio Code (VS
Code) and XAMPP, you need to: install XAMPP, configure
the PHP path within VS Code, create a project folder
within the XAMPP "htdocs" directory, and open that folder
in VS Code to start coding and running your PHP files; you
can then test your setup by accessing the project in your
web browser using "localhost" followed by your project
directory.
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
What is Open Source?
• 'Free software' is a matter of liberty, not price. To understand the
concept, you should think of 'free' as in 'free speech,' not as in 'free
beer.' - The Free Software Foundation
• What is the difference between Open Source and Freeware?
• Freeware is software that is free to use but you do not have access to
the source of that application. Open Source means you have the
ability to view and modify the code of the application. Ideally an open
source project will accept modifications from the community.
• Is PHP Open Source?
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
Static vs. Dynamic Web Sites
• A static web site is a page of content that is rendered the same every
time it is requested.
• A dynamic web site is one with content that is regenerated every time
a user visits or reloads the site.
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
What is HTTP?
• What does HTTP stand for?
• Hypertext Transfer Protocol
• What does an HTTP Request look like?
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
What is PHP?
• June 8, 1995 PHP 1.0 is posted to the usenet group
comp.infosystems.www.authoring.cgi.
• It was created by Rasmus Lerdorf as PHP Tools.
• Then he set to work integrating his tools with the Apache web server
and less than a year later, PHP 2.0 was posted to the same usenet
group.
• PHP originally stood for: Personal Home Pages.
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
What is PHP?
• PHP now stands for: PHP Hypertext Preprocessor (a recursive
acronym).
• It is most likely the fastest and simplest tool available for creating
database-enabled web sites.
• It will work with any UNIX-based web server on every UNIX flavor out
there. The package is completely free of charge for all uses including
commercial.
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
Here is how Rasmus described PHP at the time:
• PHP is a server-side HTML embedded scripting language. It has built-
in access logging and access restriction features and also support for
embedded SQL queries to mSQL and/or Postgres95 backend
databases.
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
What does a PHP script look like?
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
PHP Functions
• An independent piece of program code that is created to make
programing easier.
The above code uses PHPs date function. The documentation can be found
at https://www.php.net/manual/en/function.date.php
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
PHP Functions
• An independent piece of program code that is created to make
programing easier.
The above code uses PHPs date function. The documentation can be found
at https://www.php.net/manual/en/function.date.php
Republic of the Philippines
Sorsogon State University
College of Information and Communications Technology
Bulan Campus
Bulan, Sorsogon
PHP and HTML
• Here is PHP and HTML integrated together: