8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
1/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 1
Introduction to
WWW, PHP & MySQL
Faculty: Trn Nguyn Thi
Email: [email protected]
Lesson 1
iNET PHP 2.0iNET PHP 2.0
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
2/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 2
Objectives
Hiu cc khi nim v website vInternet.
Tm hiu v ngn ng lp trnh PHP,mysql, & Apache.
Hiu cu trc v cch thc xydng website
Cu hnh mi trng lm vic.
Nhng d n bn c th t lm khi
kt thc kha hc.
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
3/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 3
Content
Cc khi nim Internet, WWW, v HTML
Ngn ng lp trnh PHP & MySQL
Cc thnh phn ca 1 ng dng PHP
Ci t v cu hnh Apache, MySQL, & PHP
Open-source tools
Project cui kha
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
4/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 4
iNET PHP 2.0
1. Internet, WWW,and HTML
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
5/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 5
World Wide Web
Web Page Static Page: HTML, XHTML, CSS
Dynamic Page:HTML + Server code
HTTP HyperText Transfer Protocol Defines how web pages are transferred across the Internet.
A request - response protocol A client server model
Server listens on port 80 (default)
Client sends request
Server sends response (HTML, files, images, )
Client(Browser)
Server
(Web Server)
request
response
HTTP: quy nh cch thcgi & nhn Data qua Internet.
HTML: l 1 loi Data, cdng xy dng trang web.
Website = Web Pages
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
6/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 6
Dymanic Web Page: HTML, HTTP, & PHP
CreateHTMLcontent
PHP dng to cc trang HTML c ni dung thayi ty theo yu cu gi n t Browser
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
7/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 7
URL (Uniform Resource Locator): Dng tham chiu ti ti nguyn trn Internet V d: http://inet.edu.vn/home.html?id=123
Syntax:
scheme://domain:port/path?query_string#fragment_id
URI (Uniform Resource Identifier): Dng nh danh 1 ti nguyn trn Internet
URL cng l mt URI, + phi ch r v tr. URI: /a/b/c ko phi l URL
URL & URI
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
8/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 8
HTML Hypertext Markup Language
Tiu
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
9/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 9
Website structure
FrontHome page
Module : Introduction, news, products, contact...
Back-end
LoginModule : admin module
Assign rights to modules
Font & Back-endClass Image
CSS ,Javascript
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
10/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 10
2. PHP & MySQL in Dynamic Webpage
iNET PHP 2.0
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
11/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 11
Advantages
PHP & MySQL Work well together Fast & Easy in use
Have open-source power
Have community support
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
12/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 12
Components of PHP Application
Apache: web server Free The server to run server languages
Run on different OS: Linux, Windows
The same as IIS of .NET, or Tomcat of Java URL:http://httpd.apache.org
1.3 , 2.0 , 2.2 -> 2.2.15 ,2.3
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
13/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 13
MySQL: database server Free An open system
The most popularDB
Fast access, secure, stable, Easy-to-use, scalable
Can run on many OS
provides powerful utility functions
URL: http://www.mysql.com
Version: 4.1 , 5.0 ,5.1 - > 5.1.45
Components of PHP Application
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
14/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 14
PHP Programming Language
PHP(Hypertext Preprocessor):
Server-side HTML embedded scripting language
A lot of tools for developing Dynamic websites.
developed by communities
Free Run on many OS
URL:www.php.net
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
15/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 15
PHP versions
PHP: programing language First appear in 1994 PHP 3: 1997
PHP 4: 1999
PHP 5: 2003 : Object Oriented Current Version: 5.2.13
PHP 6: namespace
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
16/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 16
3. Installation & ConfigurationApache, MySQL and PHP
iNET PHP 2.0
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
17/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 17
Installation
Install separately Apache, MySQL,
PHP
Install all-in-one package
XAMPP or
WAMP
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
18/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 18
InstallingApache
Go to:http://httpd.apache.org
Download the Apache 2.2.x win32 apache_2.2.x-win32-x86-no_ssl.msi
apache_2.2.x-win32-x86-openssl-.msi
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
19/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 19
Installing Apache (cont.)
Following the Installation Wizard
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
20/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 20
Installing Apache (cont.)
Server Network Information Dialog
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
21/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 21
Installing Apache (cont.)
Apaches default index page after installation
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
22/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 22
Installing PHP manually
Go to http://www.php.net
Download the PHP 5.2.x zip pakage
PHP-5.2.6-Win32.zip
Unzip to the folderC:\PHP Edit the httpd.conf
Append the following 3 lines:
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
23/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 23
Installing PHP manually (cont.)
Go to folder C:\PHP
Edit file php.ini-recommended and
Save As php.ini
Restart the Apache server
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
24/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 24
Test PHP installation
Create a file: phpinfo.php with the content
Save it under the Apache DocumentRoot directory
Open URL http://localhost/phpinfo.php
The result should be
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
25/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 25
Installing MySQL
Go to http://www.mysql.com
Download the window installer of MySQL 5.0.xmysql-essential-5.0.51b-win32.msi
Follow the MySQL Setup Wizard
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
26/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 26
Installing MySQL (cont.)
The MySQL.com account setup dialog
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
27/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 27
Installing MySQL (cont.)
Customizes the database settings
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
28/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 28
Installing MySQL (cont.)
How to start MySQL and setup the system PATH
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
29/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 29
Installing MySQL (cont.)
Security settings: root password
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
30/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 30
Config PHP connectto MySQL
Open the php.ini file
Find the extension_dirdirective and modify as follows:
Find the extension directive and modify as follow
Append C:\php to the PATH system variable My Computer->Properties->Advanced->Environment Variables
Restart Windows & Browse the phpinfo.phppage.
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
31/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 31
4. Open-source tools
iNET PHP 2.0
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
32/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 32
Open source tools
All-in-one installation package :XAMPP:
WAMP
Database:phpMyAdmin (web-based)
navicate
ToolDreamweaver
Notepad
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
33/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 33
5. Course Projects
iNET PHP 2.0
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
34/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 34
in-course Project
Cc v d trong kha hc c ly t d ndemo l website iNET-PHP.
Tnh nng ca website: Xem tin theo ch
Module qun tr Login
Phn quyn
To ch
Nhp tin Upload nh.
Folder:/Projects/iNET-PHP/
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
35/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 35
End-course Project
Chn pht trin tip tnh nng:1. Qun l sn phm
2. Qun l thnh vin
3. t hng & X l n hng
4. Qun l khch hng
5. Qun l th vin
..
Hoc pht trin li website (user & admin)
modem.vn vieclam.inet.vn
niit.vn
Chia nhm2-3 ngi,
ng k Projectvi Ging vin
trc buihc 3
8/7/2019 Lesson 01 - Introction WWW, PHP , MySQL
36/36
2010 by iNET Academy www.iNET.edu.vn - www.NIITvn 36
iNET PHP 2.0