Download presentation
Presentation is loading. Please wait.
Published byDominick Matthews Modified over 6 years ago
1
Introduction to PHP FdSc Module 109 Server side scripting and
Database design 2014
2
Client server architecture
3
Client server architecture
Client server computing is: an environment which satisfies a business need by appropriately allocating the application processing between the client and server processors A client provides presentation services, computing power and connectivity A server provides computing, connectivity and database services
4
Client server architecture
The protocol is that the Client requests a service from the server The server processes the request and returns the results to the client A server can service many clients at the same time and regulate their access to shared resources A server can reside on the same machine as the client, or on a different machine across a network
5
Client server architecture
Ideal client server software is independent of hardware or operating systems Client server is scalable Extra clients can be added or removed with only slight performance impacts Servers can be migrated to bigger or multiple machines
6
Client server architecture
Server code and data are centrally managed Cheaper maintenance Data integrity Secure access
7
Benefits Data is available to all authorised users
Structured Query Language (SQL) allows access from all client processors and software Applications can be developed without regard to hardware platforms or technical characteristics of the software Systems using SQL are transparent to data storage location and technology
8
Benefits Applications can have a consistent look and feel
Servers can be repaired, replaced, upgraded or relocated without the client being aware
9
Database software Comparison of industrial databases (and Access)
Product Maximum Size Maximum Table size Maximum row size Maximum fields per row IBM DB2 512 TB 32 kB 1012 MS SQL 524 TB Unlimited 30k MySQL 265 TB 64 kB 4096 Oracle 4GB 8 kB 1000 MS Access 2 GB 16 MB 255
10
Server components
11
Components of a client server web based application
Database and server Returns data when requested by SQL We will use MySQL Web server Serves web pages in HTML We use Apache Server side PHP interpreter Substitutes HTML for PHP scripts which can issue SQL and return data Client Your web browser of choice
12
College set up Each student has For home you can use XAMPP
A folder for storing the web site MySQL PHP FTP access Apache For home you can use XAMPP
13
Tools Contextual editors FTP MySQL Notepad++ (Windows) GEDIT (Linux)
PHPStorm IDE FTP Filezilla MySQL PHPMyAdmin
14
What is PHP? A server side language
Scripts that allow you to control the content of web pages Unlike Javascript in the browser, which does the same job, PHP runs on the web server PHP scripts are embedded in HTML pages When the page is served, the PHP interpreter replaces the PHP with HTML, based on what the script tells it to do
15
Example XHTML 1.0 Strict//EN"
" <html xm<!DOCTYPE html PUBLIC "-//W3C//DTD lns=" xml:lang="en" lang="en"> <head> <title>Today’s Date</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <body> <p>Today’s date (according to this web server) is <?php echo date('l, F dS Y.'); ?> </p> </body> </html>
16
What the browser shows Today’s date (according to this web server) is Saturday, January 28th 2012. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " <html xmlns=" xml:lang="en" lang="en"> <head> <title>Today’s Date</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <body> <p>Today’s date (according to this web server) is Saturday, January 28th 2012. </p> </body> </html>
17
Advantages No browser incompatibility issues
Browser only receives HTML Access to server side resources Databases Reduced load on client Java can significantly slow down browsers
18
Practicalities – method 1
Use an FTP client (I use Filezilla) to create a subdirectory on your student account Host is hosting.computing.hct.ac.uk User is your hosting: username Password is your hosting: password The web site is: hosting.computing.hct.ac.uk/username Use a contextual editor (Notepad++ or gedit to create the file we just used and save it with a file type of .php (I called it test1.php) in the subdirectory Access it using your browser Make sure it works
19
Practicalities – method 2
PHPStorm – connections Select Settings from the File menu Select Deployment
20
PHPStorm - connections
Use these settings, replacing BDOCMS with your username Then select Advanced Options
21
PHPStorm - connections
In advanced options select Passive Mode
22
PHPStorm - connections
Select the Mappings tab and set up the local storage Test the connection then click OK
23
PHPStorm usage PHPStorm has a contextual editor working on local files and will automatically synch up to the host.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.