1 session 1: introduction to php & mysql inet academy open source web development
TRANSCRIPT
![Page 1: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/1.jpg)
1
Session 1: Introduction to PHP & MySQL
iNET Academy
Open Source Web Development
![Page 2: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/2.jpg)
2
Objectives
PHP & MySQL in web development Components of PHP applications Installation & Configurations of Apache,
MySQL and PHP Open source tools
![Page 3: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/3.jpg)
3
World Wide Web Web pages
Created by HTML => Static pages Dynamic pages
By modifying HTML code By using CGI programs written in C or Perl PHP&MySQL make creating dynamic websites easier and faster
World Wide Web: HTML & XHTML CSS URI HTTP
HTTP – HyperText Transfer Protocol Developed by W3C and IETF Defines how web pages are transferred across the Internet. A request-and-response protocol that connects clients and servers
Server listen on port 80 Client send request Server send back response (files, images …)
HTTP => TCP => IP
![Page 4: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/4.jpg)
4
PHP&MySQL in web development
PHP&MySQL work well together PHP&MySQL have open source power PHP&MySQL have community support PHP&MySQL are fast PHP&MySQL don’t bog you down with
unnecessary details
![Page 5: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/5.jpg)
5
Components of a PHP Application
PHP: programing language First appear in 1994 Is an interpreted language Compete with ASP and JSP Simply but powerful Compatible with many OS Can be extended with new capabilities
![Page 6: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/6.jpg)
6
Components of a PHP Application (cont.) Apache: web server
Get browser request and return web pages Currently have 3 versions:
1.3.x 2.0.x rewrite and support threading 2.2.x
Apache vs IIS Uses modules to load extensions Works with many OSs
![Page 7: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/7.jpg)
7
Components of a PHP Application (cont.) MySQL: database server
Developed in 1990 Support different database engines: MyISAM
and InnoDB Three versions currently
4.1 5.0 5.1
![Page 8: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/8.jpg)
8
Integrating many sources of Information Web pages includes not only HTML code but
also CSS: Cascading Style Sheets PHP/JSP/ASP Java Script
![Page 9: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/9.jpg)
9
Requesting data from a web page
![Page 10: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/10.jpg)
10
Requesting data from a web page (cont.)
![Page 11: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/11.jpg)
11
Installation
Install Apache, MySQL and PHP separately Install all-in-one package XAMPP
![Page 12: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/12.jpg)
12
Installing Apache using Installation Wizard Goto website http://httpd.apache.org Download the Apache 2.2.x Win32 MSI
apache_2.2.x-win32-x86-no_ssl.msi apache_2.2.x-win32-x86-openssl-….msi
![Page 13: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/13.jpg)
13
Installing Apache using Installation Wizard (cont.) The Installation Wizard prompts you for basic
configuration
![Page 14: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/14.jpg)
14
Installing Apache using Installation Wizard (cont.) Apache License terms and conditions for use
![Page 15: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/15.jpg)
15
Installing Apache using Installation Wizard (cont.) Apache HTTP Server Information
![Page 16: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/16.jpg)
16
Installing Apache using Installation Wizard (cont.) Server Network Information Dialog
![Page 17: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/17.jpg)
17
Installing Apache using Installation Wizard (cont.) Selecting a setup type
![Page 18: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/18.jpg)
18
Installing Apache using Installation Wizard (cont.) Destination Folder dialog for the Apache
installation files
![Page 19: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/19.jpg)
19
Installing Apache using Installation Wizard (cont.) “Ready to Install” dialog
![Page 20: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/20.jpg)
20
Installing Apache using Installation Wizard (cont.) Apache’s default index page after installation
![Page 21: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/21.jpg)
21
Configuring Apache
Choose Edit Apache httpd.conf
Some important directives Listen LoadModule DocumentRoot Directory Options Order, Allow, Deny Alias
![Page 22: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/22.jpg)
22
Practice: Installing & Configuring Apache
In this practice, you will Install the apache server using Installation
Wizard Config the server with the following tasks
Changge the Port to 8080 Change the DocumentRoot to another folder Add new aliases and directories Enable the Indexes directive on one of these
alias
![Page 23: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/23.jpg)
23
Installing PHP using Installation Wizard Goto http://www.php.net Download the PHP 5.2.x Win32 MSI
php-5.2.x-win32-installer.msi
![Page 24: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/24.jpg)
24
Installing PHP using Installation Wizard (cont.) The PHP MSI installer
![Page 25: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/25.jpg)
25
Installing PHP using Installation Wizard (cont.) The License Terms dialog
![Page 26: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/26.jpg)
26
Installing PHP using Installation Wizard (cont.) The installation directory for PHP
![Page 27: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/27.jpg)
27
Installing PHP using Installation Wizard (cont.) The Web Server Setup dialog
![Page 28: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/28.jpg)
28
Installing PHP using Installation Wizard (cont.) Select the Apache install path
![Page 29: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/29.jpg)
29
Installing PHP using Installation Wizard (cont.) The Installation Options dialog Choose extensions: mbstring and mysql
![Page 30: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/30.jpg)
30
Installing PHP using Installation Wizard (cont.) Dialog confirming that the installer will config
Apache
After finish, the Successful Installation dialog appears
Restart Apache Server
![Page 31: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/31.jpg)
31
Installing PHP manually
Goto the website http://www.php.net Download the PHP 5.2.x zip pakage
php-5.2.6-Win32.zip Unzip it to the folder C:\PHP Edit the httpd.conf. Add three lines as follow
at the bottom
![Page 32: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/32.jpg)
32
Installing PHP manually (cont.)
Goto folder C:\PHP Edit the file named “php.ini-recommended”
and SaveAs “php.ini” Restart the Apache server
![Page 33: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/33.jpg)
33
Test of PHP installation
Create a phpinfo.php file with the content <?php phpinfo(); ?>
Save it under the Apache DocumentRoot Directory. Open browser and type http://localhost/phpinfo.php in
the location bar The result should be
![Page 34: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/34.jpg)
34
Practice: Installing and Configuring PHP In this practice, you will:
Install PHP manually Test the installation
![Page 35: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/35.jpg)
35
Installing MySQL using Installation Wizard Goto the website http://www.mysql.com Download the window installer version of
MySQL 5.0.x mysql-essential-5.0.51b-win32.msi
![Page 36: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/36.jpg)
36
Installing MySQL using Installation Wizard (cont.) The MySQL Setup Wizard
![Page 37: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/37.jpg)
37
Installing MySQL using Installation Wizard (cont.) Select a setup type
![Page 38: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/38.jpg)
38
Installing MySQL using Installation Wizard (cont.) The MySQL.com account setup dialog
![Page 39: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/39.jpg)
39
Installing MySQL using Installation Wizard (cont.) Customizes the database settings
![Page 40: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/40.jpg)
40
Installing MySQL using Installation Wizard (cont.) Choose level of detail
![Page 41: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/41.jpg)
41
Installing MySQL using Installation Wizard (cont.) Howto start MySQL and setup the system
path
![Page 42: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/42.jpg)
42
Installing MySQL using Installation Wizard (cont.) Security setting for the database window
![Page 43: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/43.jpg)
43
Installing MySQL using Installation Wizard (cont.) Installation is completed
![Page 44: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/44.jpg)
44
Config PHP to connect to MySQL
Open the php.ini files Find the extension_dir directive and modify as follow
Find the extension directive and modify as follow
Append “;C:\php” to the system environment’s variable named Path. (MyComputer->Properties->Advanced->Environment Variables
Restart Windows then browse the phpinfo.php page.
![Page 45: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/45.jpg)
45
Config PHP to connect to MySQL (cont.)
![Page 46: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/46.jpg)
46
Practice: Installing MySQL and Configuring PHP In this practice, you will:
Install MySQL Config PHP to connect to MySQL Test the config’s result
![Page 47: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/47.jpg)
47
Open source tools
XAMPP: all-in-one installation package phpMyAdmin: admin MySQL using web-
based tool SQLyog: best GUI tool to administer MySQL Notepad++: PHP&other languages editor.
![Page 48: 1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development](https://reader035.vdocuments.mx/reader035/viewer/2022070403/56649f305503460f94c4ab8b/html5/thumbnails/48.jpg)
48
Summary
PHP is usually used to develop web applications
PHP-based web applications always go together with Apache and MySQL