pengantar teknologi web 5
DESCRIPTION
Pengantar Teknologi Web 5. Server-side Technologies. Server side technologies. Hardware: Server Software: Web server Server side Programming Tools Utility Programming Tools Database Server. Komponen Web. Mapping URL Sistem Web. Web Server vs Web Application. Web Application: - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/1.jpg)
Pengantar Teknologi Web 5
Server-side Technologies
![Page 2: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/2.jpg)
Server side technologies
• Hardware:– Server
• Software:– Web server– Server side Programming Tools– Utility Programming Tools– Database Server
![Page 3: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/3.jpg)
Komponen Web
![Page 4: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/4.jpg)
Mapping URL Sistem Web
![Page 5: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/5.jpg)
Web Server vs Web Application• Web Application:
– Menggunakan bahasa Pemprograman(misal ASP, PHP, Java, .Net, Perl atau .NET)
• Web Server:– Melayani permintaan client dan meneruskan ke aplikasi yang sesuai
selanjutnya diproses oleh aplikasi yang sesuai (misal IIS, Apache, thttpd dll.)
• Web Application tidak bisa jalan tanpa Web Server• Web Server bisa bekerja tanpa Web Application (Tapi hanya
bisa melayani web dengan content statis)
![Page 6: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/6.jpg)
Web Server
• Web Server: apache, xitami, PWS, IIS• Biasanya diinstall bersama dengan PHP
dan MySQL => ApacheTriad– Aplikasi free, ukuran cukup besar– Tidak perlu konfigurasi
• Hanya perlu user & password apache dan MySQL
• Bisa diinstall di Linux (XAMPP) dan Windows (WAMPP)
![Page 7: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/7.jpg)
http://www.apachefriends.org/en/xampp-windows.html
![Page 8: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/8.jpg)
File konfigurasi Web Server
• httpd.conf• srm.conf• access.conf
• Juga perlu setting:– Virtual Host
![Page 9: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/9.jpg)
Httpd.conf
• ServerType – berdiri sendiri / manual inetd.• ServerRoot – directory konfigurasi.• PidFile – nomor proses ID• ResourceConfig / AccessConfig• TimeOut – batas waktu time out.• KeepAlive – simultan koneksi dari satu IP.• MaxKeepAliveRequest – max. keep alive.• KeepAliveTimeOut
![Page 10: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/10.jpg)
Httpd.conf• MinSpareServers & MaxSpareServers – jumlah
server untuk server farm.• StartServers – server di jalankan.• MaxClients – jmlh koneksi simultan di server.• MaxRequestsPerChild• BindAddress – IP yang di tempelkan.• Port – port yang di dengar Apache.• User & Group – owner dari Apache Web.• ServerAdmin – e-mail admin Web server.
![Page 11: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/11.jpg)
httpd.conf
• ServerName – nama server.• ErrorLog• LogLevel – level emerg, alert, crit, errors.• CustomLog – catat akses client & virtual host.• ServerSignature – dikirim saat file tidak ada.• UserCanonicalName• HostnameLookups – catat hostname akses.
![Page 12: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/12.jpg)
srm.conf
• DocumentRoot – directory root HTML.• UserDir – public_html, http://server/~user.• DirectoryIndex – index file.• FancyIndexing• AccessFileName - .htaccess• Alias – alias directory khusus, cgi-bin• DefaultType – Default tipe dokumen
![Page 13: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/13.jpg)
access.conf<Directory />
Options FollowSymLinksAllowOverride None
</Directory><Directory “/usr/local/apache/htdocs”>
Options Indexes FollowSymLinksAllowOverride NoneAllow from all
</Directory>
![Page 14: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/14.jpg)
Virtual Host – IP based
<VirtualHost 192.168.0.1>DocumentRoot /path/to/documentServerName www.vhost1.com
</VirtualHost>
![Page 15: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/15.jpg)
Virtual Host – name basedNameVirtualHost 192.168.0.128
<VirtualHost 192.168.0.128>DocumentRoot /path/to/document1ServerName www.vhost1.com
</VirtualHost>
<VirtualHost 192.168.0.128>DocumentRoot /path/to/document2ServerName www.vhost2.com
</VirtualHost>
![Page 16: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/16.jpg)
Susunan directory• bin file-file program• build• cgi-bin script cgi• conf tempat konfigurasi• error error message• htdocs dokumen yang akan dipublish• icons gambar-gambar kecil• include• lib• logs• man manual pages• manual dokumentasi• modules module
![Page 17: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/17.jpg)
Server side programming
• Bahasa: PHP, ASP classic, ColdFusion, ASP.NET, JSP / JSF, Ruby on Rails
• PHP: PHP Hypertext Preprocessors• Gratis dari www.php.net • Mirip dengan bhs Java dan C• Bhs scripting yg paling populer• Rasmus Lerdorf, Andi Gutmans, Zeev Suraski
![Page 18: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/18.jpg)
How PHP works?
• User mengetikkan suatu alamat:– http://www.example.com/login.php
• Dilakukan DNS – Routing• Diterima oleh web server (mis: Apache)• Karena merupakan script PHP, maka isi script
PHP diparsing dan diproses oleh interpreter php, dan dikembalikan dalam bentuk teks HTML
• Teks HTML dikembalikan ke user dan ditampilkan di browser
![Page 19: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/19.jpg)
Why is PHP used?1. Easy to Use
Code is embedded into HTML. The PHP code is enclosed in special start and end tags that allow you to jump into and out of "PHP mode".
<html> <head> <title>Example</title> </head> <body>
<?php echo "Hi, I'm a PHP script!"; ?>
</body></html>
![Page 20: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/20.jpg)
Why is PHP used?2. Cross Platform
Runs on almost any Web server on several operating systems.One of the strongest features is the wide range of supported databases
Web Servers: Apache, Microsoft IIS, Caudium, Netscape Enterprise Server
Operating Systems: UNIX (HP-UX,OpenBSD,Solaris,Linux), Mac OSX, Windows NT/98/2000/XP/2003
Supported Databases: Adabas D, dBase,Empress, FilePro (read-only), Hyperwave,IBM DB2, Informix, Ingres, InterBase, FrontBase, mSQL, Direct MS-SQL, MySQL, ODBC, Oracle (OCI7 and OCI8), Ovrimos, PostgreSQL, SQLite, Solid, Sybase, Velocis,Unix dbm
![Page 21: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/21.jpg)
Why is PHP used?3. Cost Benefits
PHP is free. Open source code means that the entire PHP community will contribute towards bug fixes. There are several add-on technologies (libraries) for PHP that are also free.
PHPSoftware Free
Platform Free (Linux)
Development Tools FreePHP Coder, jEdit
![Page 22: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/22.jpg)
Dukungan PHP• GD (GIF, JPEG,
PNG) • SNMP• IMAP (POP, NNTP)• FTP• XML parser• PDF generation• DCOM (Win32 only) • SWF (Flash)
•zlib (compressed IO)
•Charset/text conversion (UTF-8, Cyrillic, Hebrew)
•SOAP
•Cybercash •ASPELL/PSPELL
![Page 23: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/23.jpg)
Arsitektur PHP 4
![Page 24: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/24.jpg)
PHP Script
![Page 25: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/25.jpg)
PHP syntax
![Page 26: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/26.jpg)
Komentar
• Tanda //,digunakan untuk komentar satu baris
• Tanda /* dan */, digunakan untuk mengawali dan mengakhiri komentar
• Tanda #, digunakan untuk komentar satu baris
![Page 27: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/27.jpg)
Tipe data• Tipe Skalar:
– boolean – integer – floating-point number (float) – string
• Tipe Compound: – array – object
• Tipe Special: – NULL
• Tipe Boolean:– TRUE / FALSE
![Page 28: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/28.jpg)
Tipe Data Numerik
• Numerik Bulat• Desimal (base-10)• Oktal (base-8, diawali 0 [nol])• Hexadesimal (base-16, diawali 0x [nol x])• Lebar 32 bit
![Page 29: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/29.jpg)
Tipe Data Float
• Angka Desimal • Lebar 64 bit • Maksimum ~1.8e308 • Presisi 14
![Page 30: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/30.jpg)
Tipe String
• Gabungan Karakter • Single Quote • Double Quote • Heredoc Syntax
![Page 31: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/31.jpg)
Konstanta
<?define(“USERNAME”,”Antonie”); echo “User Name :”.USERNAME;
?>
![Page 32: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/32.jpg)
Deklarasi Variabel
![Page 33: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/33.jpg)
Konversi String ke Angka
• Contoh:– $a = 1 + “10.5”;– $a = 1 + “-1.3e3”;– $a = 1 + “bob-1.3e3”;– $a = 1 + “bob3”;– $a = 1 + “10 ayam kate”;– $a = 1 + “10.2 ayam kate”;– $a = “10.0 ayam” + 1;
![Page 34: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/34.jpg)
Operator
• Arithmetic (+, -, *, /)• Concatenation (.) • Assigment(+=, -=, /=, *=, %=, .=)• Comparison (==, !=, >, <, >=, <=)• Logical (||, &&, !)
![Page 35: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/35.jpg)
If syntax
![Page 36: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/36.jpg)
Switch
![Page 37: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/37.jpg)
while
![Page 38: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/38.jpg)
for
![Page 39: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/39.jpg)
break
![Page 40: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/40.jpg)
continue
![Page 41: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/41.jpg)
array
![Page 42: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/42.jpg)
Custom Array• Contoh pembuatan array dengan custom key
<?php// This array is the same as ...array(5 => 43, 32, 56, "b" => 12);// ...this arrayarray(5 => 43, 6 => 32, 7 => 56, "b" => 12);?>
• Size of array is not defined• If you add a new element the maximum of the
integer indices is taken, and the new key will be that maximum value + 1
![Page 43: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/43.jpg)
While-list
![Page 44: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/44.jpg)
Foreach (1)<?php
$arr = array("one", "two", "three");reset($arr);while (list($key, $value) = each ($arr)) { echo "Key: $key; Value: $value<br />\n";}foreach ($arr as $key => $value) { echo "Key: $key; Value: $value<br />\n";}
?>
![Page 45: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/45.jpg)
Foreach (2)<?php
$arr = array("one", "two", "three");reset ($arr);while (list(, $value) = each ($arr)) { echo "Value: $value<br />\n";}foreach ($arr as $value) { echo "Value: $value<br />\n";}
?>
![Page 46: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/46.jpg)
Fungsi-fungsi dalam array
![Page 47: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/47.jpg)
Contoh<? //explodeimplode.php$city[0]="Jogja";$city[1]="Bandung";$city[3]="Surabaya";$strgabung = implode("-",$city);echo "Stlh digabung: ".$strgabung."<br>";$cityarray = explode("-",$strgabung);foreach ($cityarray as $key=>$value){echo "Array ke-".$key." = ".$value."<br>";}?>
![Page 48: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/48.jpg)
NULL
• NULL menyatakan variabel yang tidak ada nilainya
• Sebuah variabel NULL, jika– Dinyatakan sebagai NULL dengan opertor =– Belum pernah diberikan suatu nilai literal– Telah di unset()
• Untuk mengecek apakah variabel NULL atau tidak, dapat digunakan fungsi is_null()
![Page 49: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/49.jpg)
Unset dan Bracket
![Page 50: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/50.jpg)
function
![Page 51: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/51.jpg)
Array global
• $_GET[“varname”]• $_POST[“varname”]• $_SESSION[“varname”]• $_COOKIE[“varname”]• $_REQUEST[“varname”]• $_FILES[“varname”]
![Page 52: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/52.jpg)
Session
• session_start() //dipaling atas• session_register(<nama,nama,nama>)• session_unregister(<nama,nama,nama>• if (session_is_registered(<nama>))• unset(<nama>)• session_destroy()
![Page 53: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/53.jpg)
File upload
• If(copy(source, destination))
![Page 54: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/54.jpg)
SERVER variable
• $_SERVER is an array containing information such as– Headers– Paths– Script locations
• The entries in this array are created by the webserver. There is no guarantee that every webserver will provide any of these; servers may omit some, or provide others
![Page 55: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/55.jpg)
contoh
![Page 56: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/56.jpg)
Server Variable
• 'argv' – Array of arguments passed to the script. When
the script is run on the command line, this gives C-style access to the command line parameters. When called via the GET method, this will contain the query string.
• 'argc' – Contains the number of command line
parameters passed to the script (if run on the command line).
![Page 57: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/57.jpg)
SERVER variable• 'REMOTE_ADDR'
– The IP address from which the user is viewing the current page. • 'REMOTE_HOST'
– The Host name from which the user is viewing the current page. The reverse dns lookup is based off the REMOTE_ADDR of the user.
• 'REMOTE_PORT' – The port being used on the user's machine to communicate with
the web server. • $_COOKIE
– An associative array of variables passed to the current script via HTTP cookies. Automatically global in any scope.
• $_POST– An associative array of variables passed to the current script via
the HTTP POST method.
![Page 58: Pengantar Teknologi Web 5](https://reader035.vdocument.in/reader035/viewer/2022062810/56815cfe550346895dcafd89/html5/thumbnails/58.jpg)
NEXT