Web-? Web-? MySQL


   www.romver.ru
/ / Web-



( )

pj lyz d ltym hf,jnfz yfl j,yjdktybtv cjlth;bvjuj cdjtuj Web-cfqnf, yfcsofz tuj bynthtcysvb vfnthbfkfvb, ds, dthjznyj, pflevsdftntcm j njv, xnj t;tlytdyj cjplf.ncz cjnyb yjds[ Web-cfqnjd, rjnjhst nfr;t t;tlytdyj gjgjkyz.ncz cjnyzvb yjds[ ljrevtynjd. fr cjplf.ncz dct 'nb yjdst vfccbds cnhfybw b rfrbv j,hfpjv jyb nfr ,scnhj j,yjdkz.ncz? ct 'nj yt nfr ckj;yj, rfr rf;tncz yf gthdsq dpukzl, gjcrjkmre pltcm bcgjkmpetncz rjywtgwbz lbyfvbxtcrb[ Web-cnhfybw.

'njq cnfnmt vs hfccvjnhbv 'nfgs cjplfybz vt[fybpvf ge,kbrfwbb yf Web-cfqnt ghtcc-htkbpjd. fi cfqn ,eltn cjtlbyznm yf ktne ghtcc-htkbps, [hfyzobtcz d ,fpt lfyys[, c if,kjyysvb Web-cnhfybwfvb. s yt cnfdbkb wtkm. jpyfrjvbnm xbnfntktq c jcyjdfvb chtlcnd hfphf,jnrb Web-cfqnjd, gjcrjkmre j, 'njv yfgbcfyj vyj;tcndj rybu b cnfntq. fyyfz cnfnmz ghtlyfpyfxtyf d jcyjdyjv lkz nt[ gjkmpjdfntktq, rjnjhst e;t bvt.n jgsn cjplfybz Web-cnhfybw b ghjcns[ cfqnjd. fif ukfdyfz wtkm gjrfpfnm, rfr yfxfnm hfphf,fnsdfnm cdjq gthdsq lbyfvbxtcrbq Web-cfqn. kz gjybvfybz cnfnmb ;tkfntkmyj bvtnm ,fpjdst pyfybz j, fh[bntrnehf[ byajhvfwbjyys[ cbcntv, j zpsrt hfpvtnrb ubgthntrcnf (HTML) b zpsrt ghjuhfvvbhjdfybz Perl . kz cjplfybz 'njuj cfqnf vs djcgjkmpetvcz nhtvz vjoysvb jnrhsnsvb nt[yjkjubzvb: Apache, MySQL b Perl/DBI.

nj nfrjt cnfnbxtcrbq Web-cfqn?

thtl ntv, rfr gjuhepbnmcz d hfphf,jnre lbyfvbxtcrjuj Web-cfqnf, df;yj gjyznm, xnj ghtlcnfdkz.n cj,jq cnfnbxtcrbq Web-cfqn b cnfnbxtcrbt Web-cnhfybws, cjcnfdkz.obt tuj jcyjde. nfnbxtcrbt Web-cnhfybws cjplf.ncz dhexye., gjnjv cj[hfyz.ncz b pfuhe;f.ncz yf cfqn. czrbq hfp, rjulf nht,etncz bpvtybnm cjlth;bvjt nfrjq cnhfybws, gjkmpjdfntkm vjlbabwbhetn tt yf cdjtv hf,jxtv rjvgm.ntht, ghbvtyzz, rfr ghfdbkj, HTML-htlfrnjh, cj[hfyztn tt b pfntv pfyjdj pfuhe;ftn yf Web-cfqn. ybvfntkmyj ghbcvjnhtdibcm r rfrjve-yb,elm gjhnfke, ljgecnbv r CNN.com bkb BBC.co.uk, vj;yj gjlevfnm, xnj lkz j,yjdktybz cjlth;bvjuj cdjb[ cfqnjd 'nb rjvgfybb ghbdktrf.n fhvb. dthcnfkmobrjd. f cfvjv ;t ltkt ceotcndetn kexibq cgjcj, bcgjkmpjdfybt rjywtgwbb lbyfvbxtcrjuj Web-cfqnf.

nj nfrjt lbyfvbxtcrbq Web-cfqn?

f;lfz jnj,hf;ftvfz cnhfybwf lbyfvbxtcrb[ Web-cfqnjd jcyjdfyf yf if,kjyyjq cnhfybwt, d rjnjhe. dcnfdkztncz gjcnjzyyj vtyz.ottcz byajhvfwbjyyjt yfgjkytybt, rjnjhjt j,sxyj [hfybncz d ,fpt lfyys[. julf gjkmpjdfntkm pfghfibdftn cnhfybwe, cjjndtncnde.ofz byajhvfwbz bpdktrftncz bp ,fps, dcnfdkztncz d if,kjy, j,hfpez yjde. Web-cnhfybwe, b gthtcskftncz Web-cthdthjv d gjkmpjdfntkmcrbq ,hfepth, rjnjhsq b jnj,hf;ftn tt ljk;ysv j,hfpjv. hjvt byajhvfwbjyyjuj yfgjkytybz, lbyfvbxtcrb vjuen cjplfdfnmcz nfr;t b 'ktvtyns yfdbufwbb gj Web-cfqne. frbv j,hfpjv, tckb dfv ye;yj j,yjdbnm cjlth;bvjt cdjtuj cfqnf, ds ghjcnj lj,fdkztnt ntrcn lkz yjdjq cnhfybws, rjnjhsq pfntv dcnfdkztncz d ,fpe lfyys[ c gjvjom. jghtltktyyjuj vt[fybpvf. htpekmnfnt gjkexftncz, xnj Web-cfqn rfr ,s cfv ct,z j,yjdkztn.

jxtve lbyfvbxtcrbt cfqns kexit

hfpe gjckt njuj rfr lbyfvbxtcrbq cfqn cjplfy b pfgeoty d hf,jne, yfxbyf.n ghjzdkznmcz tuj ghtbveotcndf. tgthm d dfitv hfcgjhz;tybb bvttncz chfdybntkmyj yt,jkmijt rjkbxtcndj if,kjyys[ cnhfybw, c gjvjom. rjnjhs[ utythbhe.ncz cjnyb, f vj;tn ,snm, b nsczxb Web-cnhfybw. bl (lbpfqy) cfqnf vj;tn ,snm kturj bpvtyty c gjvjom. vjlbabrfwbb 'nb[ if,kjyjd. pvtytybt cjlth;bvjuj ,fps lfyys[ vj;yj ghjbpdjlbnm xthtp Web-bynthatqc c bcgjkmpjdfybtv HTML-ajhvs, yt dnjhufzcm ghb 'njv d nt[ybxtcrbt ltnfkb rf;ljq cgtwbabxtcrjq .

jplfybt lbyfvbxtcrjuj cfqnf

thdjt, xnj ye;yj lkz cjplfybz lbyfvbxtcrjuj cfqnf, 'nj Web-cthdth, yfghbvth Apache.

Web-cthdth vj;tn bcgjkmpjdfnmcz lkz j,cke;bdfybz 'ktrnhjyyjuj vfufpbyf, cthdthf yjdjcntq, gjbcrjdjuj vt[fybpvf, cbcntvs lbcnfywbjyyjuj j,extybz b lf;t lkz dctq cjdjregyjcnb gthtxbcktyys[ cath. s,jh Web-cthdthf pfdbcbn jn njuj, rfrbv dbljv ltzntkmyjcnb xfcnyjt kbwj bkb jhufybpfwbz cj,bhftncz pfybvfnmcz d ynthytnt.

tvyjubt bp ghbybvftvs[ d ,bpytct cnhfntubxtcrb[ htitybq cnjkm ;t pyfxbvs, rfr ds,jh gkfnajhvs lkz Web-cthdthf. fhfrnthbcnbrb cthdthf 'nj xhtpdsxfqyj df;ysq afrnjh, jghtltkz.obq yflt;yjcnm epkf, tuj jnpsdxbdjcnm yf pfghjcs rkbtynjd, f nfr;t nj, rfrbt ecbkbz ytj,[jlbvj ghtlghbybvfnm lkz gjllth;fybz tuj d hf,jxtv cjcnjzybb. hb ghfdbkmyjv ds,jht rjvgjytynjd b rfxtcndtyyjv ghjtrnt Web-eptk vj;tn cnfnm lkz rkbtynjd b gfhnythjd yjdsv, ,jktt elj,ysv cgjcj,jv dpfbvjltqcndbz c dfitq rjvgfybtq. thtuheprf Web-cthdthf vj;tn ghbdtcnb r njve, xnj cthdth ,fp lfyys[ bkb rfrjq-kb,j byjq htcehc cnfytn ytljcnegysv lkz rkbtynjd.

hegyst rjvgfybb lj ytlfdytuj dhtvtyb ltkfkb cnfdrb yf Microsoft Internet Information Server, Netscape FastTrack, IBM WebSphere, f Apache d jcyjdyjv bcgjkmpjdfkcz yt,jkmibvb rjvgfybzvb. lyfrj ctqxfc cbnefwbz ytcrjkmrj bpvtybkfcm, b Apache yfxbyftn gjllth;bdfnm hf,jnjcgjcj,yjcnm ytrjnjhs[ rhegys[ ynthytn-ghjtrnjd, d xfcnyjcnb Yahoo.

jkye. dthcb. cnfnmb ds vj;tnt yfqnb yf yfitv CD-ROM.

Apache ghtljcnfdkztn ,jufnst djpvj;yjcnb, gjpdjkz.obt yfcnhjbnm Web-cthdth d cjjndtncndbb c gjnht,yjcnzvb bylbdblefkmys[ b rjhgjhfnbdys[ gjkmpjdfntktq. fcnhjqrf ghjbpdjlbncz c gjvjom. lbhtrnbd, cjlth;fob[cz d rjyabuehfwbjyys[ afqkf[. Apache gjpdjkztn cjplfdfnm dbhnefkmyst Web-epks, f nfr;t dsgjkyztn aeyrwbb proxy-cthdthf. ckb ye;yj ghtljcnfdbnm ljcneg r cjlth;bvjve cthdthf kbim juhfybxtyyjve rheue kbw, Web-cthdth vj;yj yfcnhjbnm nfr, xnj,s ghb j,hfotybb r erfpfyysv rfnfkjufv cthdth ghjdthzk htubcnhfwbjyyst bvtyf b gfhjkb d cj,cndtyyjq bkb d jlyjq bp gjlrk.xtyys[ r ytve ,fp lfyys[.

fktt dfv ye;yj htibnm, rfr ds cj,bhftntcm [hfybnm byajhvfwbjyyjt yfgjkytybt (rjyntyn), rjnjhjt jnj,hf;ftncz yf Web-cnhfybwt. lfyyjq cnfnmt yf rjyrhtnyjv ghbvtht vs gjrf;tv, rfr cjplfnm ,fpe lfyys[ d MySQL, rjnjhfz gjpdjkbn yfv hfp,bnm Web-rjyntyn yf nf,kbws, cjlth;fobt gjkz b pfgbcb c lfyysvb. jkt 'nj lbcrhtnyfz tlbybwf lfyys[ d nf,kbwt. fghbvth, vs vj;tv cjplfnm nf,kbwe tbl_news_items c gjkzvb col_title, col_date, col_fullstory, col_author. MySQL jnkbxysq ds,jh lkz cjplfybz nfrjq ,fps lfyys[ dcktlcndbt ghjcnjns d bcgjkmpjdfybb b flvbybcnhbhjdfybb, cdj,jlyjq hfcghjcnhfyztvjcnb lkz hfpys[ gkfnajhv, drk.xfz Linux b Windows, b ,scnhj hfcneotq gjgekzhyjcnb.

jckt 'njuj vs cjplflbv lbyfvbxtcrbt if,kjyyst cnhfybws yf HTML. nj,s hfphf,jnfnm ghbkj;tybz lkz dpfbvjltqcndbz c ,fpjq lfyys[ b if,kjyfvb, vs djcgjkmpetvcz zpsrjv Perl.

f cfvjv ltkt yfv ytj,[jlbvj cjplfnm nhb Perl-ghjuhfvvs, bkb crhbgnf: jlby ,eltn jnj,hf;fnm ccskrb yf dct bvt.obtcz ghtcc-htkbps (pr-list-dbi.pl), lheujq cjlth;bvjt ds,hfyyjuj ghtcc-htkbpf (pr-content-dbi.pl), f nhtnbq gjpdjkbn yfv lj,fdbnm cdt;bq ghtcc-htkbp d ,fpe lfyys[ (pr-add-dbi.pl). f,jne gj dthcnrt vj;yj djpkj;bnm yf k.,bvsq HTML-htlfrnjh, yfghbvth, Allaire HomeSite (http://www.allaire.com/). jkmrj gjvybnt, xnj ghb cjplfybb if,kjyf ytj,[jlbvj jcnfdkznm gecnst j,kfcnb, d rjnjhst ,eltn dcnfdkznmcz lbyfvbxtcrjt yfgjkytybt (tcntcndtyyj, gthtvtyyjq lkbys).

jckt hfphf,jnrb j,otuj lbpfqyf lkz cdjb[ ghtcc-htkbpjd ghjcnj dcnfdmnt d erfpfyyst dsit gecnst j,kfcnb cgtwbfkmyst rk.xtdst ckjdf (cv. j, 'njv yb;t). fr njkmrj gjkmpjdfntkm pfghjcbn rfrjq-kb,j ghtcc-htkbp, Web-cthdth j,hf,jnftn Perl-rjl b pfvtybn rk.xtdst ckjdf d if,kjyf[ byajhvfwbjyysv yfgjkytybtv, bpdktxtyysv bp ,fps lfyys[, nj tcnm rfrbv-nj rjyrhtnysv ghtcc-htkbpjv.

gjcktlytt, xnj ye;yj cltkfnm, pfuhepbnm dfib if,kjys yf Web-cthdth d jghtltktyyst lbhtrnjhbb. j;yj djcgjkmpjdfnmcz FTP-rkbtynjv CuteFTP (http://www.cuteftp.com/), yj vs ghtlgjxbnftv bcgjkmpjdfnm afqkjde. j,jkjxre FAR. dt df;yst dtob, rjnjhst cktletn pfgjvybnm: gthdjt afqks if,kjyjd ljk;ys cjlth;fnm bvtyf, jrfyxbdf.obtcz yf .pl, b dnjhjt jyb ljk;ys bvtnm ghfdj yf dsgjkytybt (d UNIX-cbcntvf[ yflj dsgjkybnm rjvfyle chmod 0755 bvz_if,kjyf.pl). nj dct!

j,fdktybt aeyrwbjyfkmyjcnb

t ghtlcnfdkztn jcj,s[ ckj;yjcntq lj,fdktybt aeyrwbjyfkmys[ djpvj;yjcntq r vt[fybpve ge,kbrfwbb ghtcc-htkbpjd. j;yj jncjhnbhjdfnm ccskrb yf ljcnegyst d ,fpt lfyys[ ghtcc-htkbps gj lfnt bkb yfpdfyb., uheggbhez b[ gj ujlfv. kb, yfghbvth, ds pf[jnbnt jnj,hfpbnm ckexfqysq ghtcc-htkbp yf dfitq Web-cnhfybwt, dhtvz jn dhtvtyb ghtljcnfdkzz tuj byajhvfwb. gjctnbntkzv ytpfdbcbvj jn njuj, rjulf jy ,sk htfkmyj jge,kbrjdfy. j crjhtt dctuj cfvjq df;yjq b gjktpyjq aeyrwbjyfkmyjcnm. ,eltn lj,fdktybt HTML-ajhvs lkz ddjlf cjlth;bvjuj ghtcc-htkbpf b hfphf,jnrb CGI-ghjuhfvvs yf Perl d wtkz[ j,hf,jnrb 'njq ajhvs b gjcktle.otuj hfpvtotybz ljrevtynf d ,fpt lfyys[. fgjvybv, xnj CGI (Common Gateway Interface) ghjnjrjk, vt[fybpv, bkb ajhvfkmyjt cjukfitybt vt;le Web-cthdthjv b jnltkmyjq ghjuhfvvjq. thdth rjlbhetn d[jlyst lfyyst, yfghbvth HTML-ajhvs, f ghjuhfvvf CGI ltrjlbhetn b[ b utythbhetn gjnjr ds[jlys[ lfyys[. cgtwbabrfwbb ghjnjrjkf ybxtuj yt crfpfyj j rfrjv-kb,j jghtltktyyjv zpsrt ghjuhfvvbhjdfybz. j'njve ghjuhfvvs, cjjndtncnde.obt 'njve ghjnjrjke, vjuen ,snm yfgbcfys ghfrnbxtcrb yf k.,jv zpsrt yf C, C++, Visual Basic, Delphi, Tcl, Python bkb, rfr d yfitv ckexft, yf Perl.

jldtltv ytrjnjhst bnjub. flttvcz, xnj 'nf cnfnmz gjvj;tn dfv jwtybnm ghtbveotcndf rjywtgwbb lbyfvbxtcrb[ Web-cnhfybw gthtl cnfnbxtcrbvb. hbvtytybt lfyyjq rjywtgwbb ghbdtltn r cjrhfotyb. hexyjq hf,jns, gjvj;tn hfcghtltkbnm hf,jxe. yfuhepre cthdthf b gjpdjkbn ,scnhj edtkbxbnm rjkbxtcndj byajhvfwbjyyjuj yfgjkytybz cfqnf. jv,byfwbz bp Apache, MySQL b Perl ghtljcnfdbn ghfrnbxtcrb ,tcgkfnye., ghjcne. d bcgjkmpjdfybb, ub,re. d ecnfyjdrt b yfcnhjqrt rhjcc-gkfnajhvtyye. b vfcinf,bhetve. chtle hfphf,jnrb. ltcm vs yt ,eltv hfccvfnhbdfnm jcj,tyyjcnb b[ ecnfyjdrb, nfr rfr, dj-gthds[, yf 'nj gjghjcne yt [dfnbn vtcnf, jndtltyyjuj lkz lfyyjq cnfnmb, f dj-dnjhs[, rf;ljt bp 'nb[ chtlcnd gjcnfdkztncz dvtcnt c dtcmvf gjlhj,yjq ljrevtynfwbtq.

jplfybt ,fps lfyys[ d MySQL

fphf,jnrf vjltkb ,fps lfyys[

thdsv b yfb,jktt df;ysv ltqcndbtv ghb cjplfybb ,fps lfyys[ zdkztncz hfphf,jnrf tt vjltkb. nfr, ghbcnegftv.

fu 1

fv ye;yj rfr-nj yfpdfnm ,fpe lfyys[. fpjdtv tt db_website.

fu 2

tj,[jlbvj jghtltkbnm, xnj bvtyyj ,elen cjlth;fnm nf,kbws ,fps lfyys[. vjuen d[jlbnm cjnyb nf,kbw. yfxfkf yfv gjnht,etncz dctuj jlyf nf,kbwf lkz [hfytybz yfib[ ghtcc-htkbpjd. fpjdtv tt tbl_news_items.

fu 3

ktletn jghtltkbnm gjkz, rjnjhst ,eltn cjlth;fnm yfif nf,kbwf. nb gjkz ,elen zdkznm cj,jq dct 'ktvtyns ghtcc-htkbpf. yfitv ghbvtht bcgjkmpe.ncz gznm gjktq: col_id (xbckjdjq bltynbabrfnjh ghtcc-htkbpf), col_title (yfpdfybt), col_date (lfnf ge,kbrfwbb), col_fullstory (cjlth;bvjt), col_author (bvz fdnjhf). jkt col_id ,eltn cjlth;fnm eybrfkmysq bltynbabrfnjh, gj rjnjhjve gjkmpjdfntkm cvj;tn pfghfibdfnm cjlth;bvjt jghtltktyyjuj ghtcc-htkbpf.

jplfybt ,fps lfyys[

tgthm yfv ytj,[jlbvj ecnfyjdbnm cjtlbytybt c MySQL b cjplfnm yfie ,fpe lfyys[. b;t vs gjrf;tv, rfr cltkfnm 'nj bp rjvfylyjq cnhjrb. lyfrj ceotcndetn vyj;tcndj cbcntv eghfdktybz, bkb vtytl;thjd MySQL, rjnjhst gjpdjkz.n flvbybcnhbhjdfnm tt, bcgjkmpez lhe;tcndtyysq uhfabxtcrbq bynthatqc.

ht;lt dctuj dfv j,zpfntkmyj cktletn pyfnm jcyjds zpsrf pfghjcjd SQL (Structured Query Language). gjcnfdre MySQL d[jlbn gjkyjt jgbcfybt gjllth;bdftvjq cgtwbabrfwbb SQL. njn zpsr ytckj;ty lkz gjcnb;tybz, gjcrjkmre tuj jgthfnjhs b b[ rjycnherwbb kturj gjyznm b pfgjvybnm. kz hf,jns dfv gjnht,e.ncz jgthfnjhs cjplfybz (CREATE bkb INSERT), ds,jhrb (SELECT) b elfktybz (DROP bkb DELETE) lfyys[, f nfr;t b[ bpvtytybz (UPDATE, MODIFY). rjyrhtnys[ ghbvthf[ vs djcgjkmpetvcz njkmrj ytrjnjhsvb bp yb[.

nj,s yt hfccvfnhbdfnm ecnfyjdre gjkmpjdfntkmcrb[ extnys[ pfgbctq (user accounts) b yfpyfxtybt ytj,[jlbvs[ ghfd ljcnegf, ghtlgjkj;bv, xnj ds bcgjkmpetnt extnye. pfgbcm flvbybcnhfnjhf (root).

fu 1

nrhjqnt nthvbyfkmyjt jryj (tckb ds hf,jnftnt d uhfabxtcrjq j,jkjxrt X Window Linux bkb d Windows 9x/NT/2000) b ecnfyjdbnt cjtlbytybt c MySQL, ddtlz d rjvfylyjq cnhjrt mysql. jndtn ds ljk;ys gjkexbnm ghbukfitybt lkz ddjlf rjvfyl mysql>.

fu 2

jplflbv yfie ,fpe lfyys[, ddtlz:

CREATE DATABASE db_website;

jckt ddjlf rf;ljq rjvfyls yt pf,sdfqnt gtxfnfnm cbvdjk (;). y jxtym df;ty, gjcrjkmre gjcskftn MySQL cbuyfk rjywf ddjlf rjvfyls.

fu 3

fktt ytj,[jlbvj gjckfnm rjvfyle, erfpsdf.oe. cbcntvt MySQL, rfre. rjyrhtnyj ,fpe lfyys[ vs cj,bhftvcz bcgjkmpjdfnm. dtlbnt:

use db_website;

fu 4

jplflbv nf,kbwe tbl_news_items, ult jghtltkbv nbg lfyys[, rjnjhst ,elen [hfybnmcz d tt gjkz[. dtlbnt:

1. CREATE TABLE tbl_news_items (
2. col_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
3. col_title VARCHAR(100),
4. col_author VARCHAR(100),
5. col_body TEXT,
6. col_date DATE
7. );

fu 5

tgthm, rjulf vs cjplfkb nf,kbwe lkz [hfytybz yfib[ lfyys[, yfv ye;yj pfgjkybnm tt rfrbvb-nj ghbvthysvb lfyysvb. fvtnmnt, xnj d yb;tcktle.otq rjvfylt vs yt ,eltv jghtltkznm gjkt col_id, gjnjve xnj jyj pfgjkyztncz fdnjvfnbxtcrb gj vtht lj,fdktybz yjds[ lfyys[. fr;t bvtqnt d dble, xnj cbynfrcbc lkz lfns <ujl/vtczw/ltym>. nfr, d rjvfylyjq cnhjrt mysql> ddtlbnt cktle.oe. rjvfyle.

8. INSERT INTO tbl_news_items (col_title, _
col_author, col_body, col_date)
9. VALUES (
10. jq gthdsq ghtcc-htkbp,
11. fit vz,
12. njn ghtcc-htkbp [hfybncz d  MySQL,
13. 2001/4/15
14. );

dtlbnt tot ytcrjkmrj gjlj,ys[ pfghjcjd lkz dcnfdrb. nj,s ghjcvjnhtnm nj, xnj [hfybncz d ,fpt lfyys[, d rjvfylyjq cnhjrt mysql> ddtlbnt:

SELECT * FROM tbl_news_items;

jplfybt lbyfvbxtcrb[ Web-cnhfybw yf Perl

jlujnjdrf r hf,jnt

kz pfgecrf Perl-ghjuhfvv gjyflj,bncz bynthghtnfnjh Perl dthcbb 5.005 bkb 5.6 lbcnhb,enbdjd Perl Standard bkb ActiveState Perl lkz UNIX bkb Win32. ckb ds ,eltnt pfybvfnmcz hfphf,jnrjq ghbkj;tybq lkz aeyrwbjybhjdfybz gjl Win32, nj gfrtn jn ActiveState ytcrjkmrj elj,ytt d bcgjkmpjdfybb, r njve ;t d ytuj d[jlbn enbkbnf PPM lkz ecnfyjdrb ljgjkybntkmys[ vjlektq.

kz jhufybpfwbb dpfbvjltqcndbz yfib[ Perl-ghjuhfvv c MySQL ytj,[jlbvj, xnj,s d gjcnfdre Perl d[jlbk vjlekm DBI. jcrjkmre vjlekm d jcyjdyjv ybxtuj cfv yt ltkftn, f gthtrkflsdftn dct jgthfwbb gj dpfbvjltqcndb. c ,fpfvb lfyys[ yf cjjndtncnde.obq bv lhfqdth, nj nht,etncz ecnfyjdrf ,b,kbjntrb DBD-Mysql (lhfqdth r MySQL lkz vjlekz DBI). fr pfzdbk bv m.yc (Tim Bunce), fdnjh b hfphf,jnxbr erfpfyyjuj vjlekz, DBI 'nj API-bynthatqc lkz jhufybpfwbb ljcnegf r ,fpfv lfyys[ bp Perl-ghjuhfvv. gtwbabrfwbz DBI API jghtltkztn yf,jh aeyrwbq, gthtvtyys[ b ghfdbk, bcgjkmpetvs[ lkz ghjphfxyjuj bynthatqcf c ,fpfvb lfyys[.

jywtgwbz lhfqdthjd ,fp lfyys[ dtcmvf elj,yf, gjcrjkmre d cdjtv Perl-ghbkj;tybb ds bcgjkmpetnt cnfylfhnyst lkz DBI dspjds, rjnjhst pfntv gthtflhtce.ncz vjlekb cjjndtncnde.otve lhfqdthe, f njn, d cdj. jxthtlm, e;t yfghzve. ,eltn dpfbvjltqcndjdfnm c , yt nht,ez jn dfc bpextybz nt[ybxtcrb[ jcj,tyyjcntq rf;ljq rjyrhtnyjq . frbv j,hfpjv, ceotcnde.n lhfqdths DBD::Sybase, DBD::Oracle, DBD::Informix b n.l. (hbc. 1, 2).

bc. 1. h[bntrnehf DBI

bc. 2. jnjr lfyys[ xthtp bynthatqc DBI

tvyjuj dsqltv pf hfvrb ntvfnbrb cnfnmb. jgecnbv, xnj d gjcnfdre DBI yt d[jlbn lhfqdth lkz cgtwbabxtcrjq . lfyyjv ckexft yf gjvjom ghbltn vjcn DBD-ODBC. jcnfnjxyj cjplfnm yjdsq bcnjxybr lfyys[ (Data Source Name) lkz lhfqdthf ODBC (Open DataBase Connectivity), ult ye;yj ds,hfnm nbg 'njq , flhtc [jcnf, gj rjnjhjve yflj ecnfyjdbnm cjtlbytybt, bvz ,fps lfyys[ b fdnjhbpfwbjyyst lfyyst, nj tcnm bvz gjkmpjdfntkz b gfhjkm (hbc. 3). pfntv, bcgjkmpez vjlekm DBI, dpfbvjltqcndjdfnm c ,fpjq lfyys[. hjvt njuj, rfr ghfdbkj, d cnfylfhnye. gjcnfdre ActiveState Perl d[jlbn vjlekm Win32::ODBC (Win32-ODBC). f,jnf c ybv ytvyjuj jnkbxftncz jn hf,jns c DBI, yj d wtkjv jxtym gj[j;f. fpybwf kbim d njv, xnj Win32::ODBC vjlekm njkmrj lkz Win32-cbcntv b gjpdjkztn hf,jnfnm c hjlysvb aeyrwbzvb ODBC ,jktt 'aatrnbdyj, xtv DBD::ODBC.

bc. 3. j,fdktybt yjdjuj bcnjxybrf lfyys[ xthtp ODBC-flvbybcnhfnjh

t;le ODBC b DBI vj;yj ghjdtcnb gfhfkktkm. DBI 'nj fyfkju ODBC Administrator (vtytl;thf lhfqdthjd ,fp lfyys[). f;lsq DBD-lhfqdth gj cdjbv aeyrwbzv cjjndtncndetn ODBC-lhfqdthe. j;tn cvenbnm kbim njn afrn, xnj ceotcndetn, rfr ujdjhbkjcm dsit, lhfqdth DBD::ODBC. j jy dctuj kbim gjpdjkztn ecnfyjdbnm cdzpm DBI c ODBC-lhfqdthfvb.

kz ecnfyjdrb DBI b DBD-Mysql, c gjvjom. enbkbns PPM d chtlt Win32 ddtlbnt d rjvfylyjq cnhjrt:

ppm install DBI

,hfnbnt dybvfybt, xnj d 'njn vjvtyn dfi rjvgm.nth ljk;ty ,snm gjlrk.xty r ynthytne. ckb ;t cjjndtncnde.obq vjlekm bvttncz e dfc yf kjrfkmyjv lbcrt, djcgjkmpeqntcm cghfdjxyjq byajhvfwbtq, ddtlz rjvfyle:

ppm help install

kz gjkmpjdfntktq UNIX-cbcntv ecnfyjdrf vjlekz DBI ,eltn ghj[jlbnm ghfrnbxtcrb nfr ;t, rfr b ecnfyjdrf lheub[ Perl-vjlektq:

tar zxvf DBI-1.06.tar.gz
cd DBI-1.06/
perl Makefile.PL
make
make test
make install

j;yj nfr;t djcgjkmpjdfnmcz j,jkjxrjq CPAN. ckb ;t yf dfitv rjvgm.ntht ecnfyjdktyf UNIX-dthcbz gfrtnf jn ActiveState, nj vj;yj hf,jnfnm b c ecnfyjdjxyjq enbkbnjq PPM. yjulf ,sdftn, xnj j,jkjxrb CPAN b PPM yt aeyrwbjybhe.n, tckb d ctnb ghtlghbznbz, r rjnjhjq gjlrk.xty dfi rjvgm.nth, ecnfyjdkty ,hfylvfe'h, bkb ctntdjq 'rhfy (firewall). lfyyjv ckexft dfv gjvjuen njkmrj vjlekb c bc[jlysvb ntrcnfvb, pfuhe;tyyst dhexye.. kz b[ ecnfyjdrb b gjlrk.xtybz r Perl bkb Apache gjnht,etncz bynthghtnfnjh Perl, rjvgbkznjh C/C++ bkb GCC/PGCC b rfrfz-kb,j bp enbkbn-c,jhobrjd make (bp gjcnfdrb jlyjuj bp rkjyjd UNIX, f nfr;t Microsoft Visual C++), nmake bkb dmake. frbv j,hfpjv, ghjwtlehf ecnfyjdrb vjlektq ytcrjkmrj eckj;yztncz. jxnb c rf;lsv bp yb[ gjcnfdkztncz ljrevtynfwbz gj c,jhrt, ,kfujlfhz rjnjhjq e dfc yt ljk;yj djpybryenm jcj,s[ nhelyjcntq.

sdjl cgbcrf cnfntq

tgthm, rjulf e dfc tcnm hf,jnf.ofz ,fpf lfyys[ c ghtcc-htkbpfvb, vj;yj ,tp jcj,s[ ghj,ktv gjlrk.xbnm tt r Web-cnhfybwt. fxytv c cjplfybz ghjcntqitq cnhfybws, rjnjhfz jnj,hf;ftn cgbcjr dct[ bvt.ob[cz ghtcc-htkbpjd. fvtnmnt, xnj gj evjkxfyb. Web-cthdth Apache levftnm, xnj dct dfib ljrevtyns ljk;ys yf[jlbncz d tuj lbhtrnjhbb htdocs, f bcgjkyztvst afqks d cgi-bin. ktljdfntkmyj, ytj,[jlbvj gjvtcnbnm dct afqks c hfcibhtybtv .pl d rfnfkju cgi-bin. cdj. jxthtlm, cjplfdftvst afqks HTML-if,kjyjd ye;yj hfpvtcnbnm d rfnfkjut tpl. thfh[bz rfnfkjujd ,eltn dsukzltnm cktle.obv j,hfpjv:

/ (rjhtym k.,juj lbcrf)
/local
/local/usr
/local/usr/bin
/local/usr/cgi-bin
/local/usr/htdocs
/local/usr/tpl

kz cbcntv DOS/Windows genm r cgi-bin vj;tn dsukzltnm nfr:

c:localusrcgi-bin

fu 1

cgjkmpez cdjq k.,bvsq ntrcnjdsq htlfrnjh, cjplfqnt afqk pr-list-tpl.htm:

15. 
16. 
17. 
18. 
19. 
20. @BLOCK@
21. 
22. 

njn afqk ghtlyfpyfxty lkz jnj,hf;tybz cgbcrf dct[ ljcnegys[ ghtcc-htkbpjd.

fu 2

jplfqnt afqk pr-list-block-tpl.htm, rjnjhsq ,eltn jnj,hf;fnm rf;lsq ,kjr c yfqltyysv ghtcc-htkbpjv d dblt nf,kbws:

23. 
"2" cellspacing="1">
24. 
25. 
26. 
"/cgi-bin/@READ@?id=@NUMBER@">@TITLE@
@AUTHOR@, _
@DATE@

fu 3

jplfqnt afqk pr-content-tpl.htm, rjnjhsq ,eltn jnj,hf;fnm cjlth;fybt ghtcc-htkbpf:

27. 
28. 
29. 
30. 
31. 
32. 

@TITLE@

33. 
34. 
35. 
36. 
37. 
@TITLE@
Author: @AUTHOR@ Date: @DATE@
@BODY@
38. Show the list of press-releases..
39. 
40. 

fu 4

jplfqnt Perl-crhbgn pr-list-dbi.pl, rjnjhsq ,eltn xbnfnm lfyyst bp ,fps lfyys[ db_website b, bcgjkmpez if,kjyyst HTML-afqks, jnj,hf;fnm cgbcjr ghtcc-htkbpjd (ntrcn 'njuj crhbgnf ds cvj;tnt yfqnb yf yfitv rjvgfrn-lbcrt).

ntgthm ghjqltvcz gj kbcnbyue rjlf b hfccvjnhbv, rfr hf,jnftn ghjuhfvvf dsdjlf cgbcrf ghtcc-htkbpjd.

nhjrb 1-9 ghtlcnfdkz.n cj,jq rfr ,s bybwbfkbpbhe.obq ,kjr, d rjnjhjv j,]zdkz.ncz dct ukj,fkmyst gthtvtyyst b rjycnfyns:

41. #!/local/usr/bin/perl
42. 
43. use DBI;
44. $dbh = DBI->connect(dbi:mysql:db_website,root,);
45. $path = "/local/usr/tpl";
46. $TPL_LIST = "$path/pr-list-tpl.htm";
47. $TPL_LIST_BLOCK = "$path/pr-list-block-tpl.htm";
48. 
49. print "Content-type:text/htmlnn";

gthdf vs cjj,oftv Web-cthdthe Apache genm, erfpsdf.obq, ult yf[jlbncz bynthghtnfnjh Perl, rjnjhsq pfgecrftncz ghb pfghjct crhbgnf, ghjdthztn tuj yf jib,rb b pfntv dsgjkyztn tuj. fktt vs j,]zdkztv vjlekm DBI (DataBase Interface), vtnjls rjnjhjuj ,elen bcgjkmpjdfnmcz d ghjuhfvvt lkz dpfbvjltqcndbz c ,fpjq lfyys[ (cnhjrf 3). fntv vs ecnfyfdkbdftv cjtlbytybt c yfitq ,fpjq lfyys[ db_website (4), erfpsdfz d rfxtcndt d[jlyjuj bvtyb gjkmpjdfntkz root (flvbybcnhfnjh), f d rfxtcndt gfhjkz gecne. cnhjre (pyfxtybt, ghbyznjt gj evjkxfyb.). gthtvtyyjq $path erfpsdftv genm, gj rjnjhjve yf[jlzncz afqks HTML-if,kjyjd (5). gthtvtyys[ $TPL_LIST b $TPL_LIST_BLOCK cjjndtncndtyyj erfpsdftv b[ bvtyf (6, 7). jnjv, cjj,oftv Web-cthdthe, xnj dct bc[jlzobt lfyyst ljk;ys ghtlcnfdkznmcz d MIME-ajhvfnt text/html lkz dsdjlf HTML-gjnjrf d gjkmpjdfntkmcrbq ,hfepth (9).

nhjrb 11-22 ghtlcnfdkz.n cj,jq ntkj ghjuhfvvs:

50. 
51. open (L, "$TPL_LIST");
52. while ($line1=) {
53. chomp($line1);
54. if ($line1=~/@BLOCK@/) {
55. read_db();
56. ins_data();
57. } else {
58. print "$line1n"; 
59. }
60. }
61. close(L);
62. 
63. $dbh->disconnect;

nrhsdftv afqk-if,kjy pr-list-tpl.htm (11) b d wbrkt (12-20) ghjcvfnhbdftv tuj, pfgbcsdfz rf;le. cxbnfyye. cnhjre d gthtvtyye. $line. j dhtvz rf;ljq bnthfwbb ghjbpdjlbv ghjdthre yf yfkbxbt d 'njq cnhjrt rk.xtdjuj ckjdf @BLOCK@ (14-19), jpyfxf.otuj, xnj d lfyyjv vtcnt yflj dcnfdbnm ,kjr c ghtcc-htkbpjv. fr njkmrj jyj yfqltyj, dspsdftv ghjwtlehs read_db() b ins_data().

nhjrb 26-39 ntkj ghjwtlehs read_db(), ghtlyfpyfxtyyjq lkz cxbnsdfybz cjlth;bvjuj nf,kbws tbl_news_items, d rjnjhjq [hfyzncz yfib ghtcc-htkbps:

64. 
65. 
66. sub read_db {
67. $c=0;
68. my($sql) = "SELECT * FROM tbl_news_items";
69. $rs = $dbh->prepare($sql);
70. $rs->execute;
71. while (my $ref = $rs->fetchrow_hashref()) {
72. $id[$c] = "$ref->{col_id}";
73. $title[$c] = "$ref->{col_title}";
74. $author[$c] = "$ref->{col_author}";
75. $date[$c] = "$ref->{col_date}";
76. $c++;
77. }
78. $rs->finish();
79. }

ybwbfkbpbhetv cxtnxbr $c=0, cjcnfdkztv pfghjc ds,jhrb dct[ lfyys[ bp nf,kbws (28), dsgjkyztv pfghjc (29, 30) b gjkexftv lfyyst d htrjhlctn (recordset yf,jh pfgbctq) $rs. fntv d wbrkt (31-37) bpdktrftv lfyyst bp htrjhlctnf, bcgjkmpez vtnjl fetshrow_hashref b djpdhfofz ccskre yf fccjwbfnbdysq vfccbd %ref (31), cjlth;fobq bvtyf b pyfxtybz gjktq ntreotq pfgbcb. fgbcsdftv bpdktxtyyst lfyyst (32-35) d cjjndtncnde.obt b[ nbgfv j,sxyst vfccbds @id, @title, @author b @date. frhsdftv htrjhlctn (38).

nhjrb 41-53 ntkj ghjwtlehs ins_data(), htfkbpe.otq dcnfdre bpdktxtyys[ bp lfyys[ d bc[jlzobq gjnjr lfyys[; cnhjrb 55-63 ntkj ghjwtlehs pr_block(), dspsdftvjq d wbrkt bp ghjwtlehs ins_data():

80. 
81. sub ins_data {
82. $toread = "pr-read-dbi.pl";
83. for ($i=0; $i<$c; $i++) {
84. $line = &pr_block;
85. 
86. $line =~ s/@NUMBER@/$id[$i]/;
87. $line =~ s/@TITLE@/$title[$i]/;
88. $line =~ s/@AUTHOR@/$author[$i]/;
89. $line =~ s/@DATE@/$date[$i]/;
90. $line =~ s/@READ@/$toread/;
91. print "$line";
92. }
93. }
94. 
95. sub pr_block {
96. my($block) = ;
97. open (B, "$TPL_LIST_BLOCK");
98. while ($line=) {
99. $block = $block.$line;
100. }
101. close(B);
102. return ($block);
103. }

nfr, gjkexbd d htpekmnfnt dsgjkytybz ghjwtlehs read_db() vfrcbvfkmyjt pyfxtybt cxtnxbrf $c, d wbrkt (43-52) vs pfgecrftv ghjwtlehe pr_block(), rjnjhfz xbnftn cjlth;bvjt HTML-if,kjyf pr-list-block-tpl.htm b pfgbcsdftn tuj d gthtvtyye. $block (59), pyfxtybt rjnjhjq pfntv djpdhfoftncz (62) d gthtvtyye. $line (44) ghjwtlehs ins_data(). fktt d 'njv ;t wbrkt vs pfvtyztv (46-50) yfqltyyst d bc[jlzotv gjnjrt $line rk.xtdst ckjdf @NUMBER@, @TITLE@, @AUTHOR@, @DATE@, @READ@ yf cjjndtncnde.obt lfyyjq bnthfwbb wbrkf ($i) pyfxtybz vfccbdjd @id, @title, @author, @date b gthtvtyyjq $toread.

sdjl ntrcnf ghtcc-htkbpf

jckt njuj rfr vs dsdtkb cgbcjr dct[ bvt.ob[cz d ,fpt lfyys[ ghtcc-htkbpjd (hbc. 4), ye;yj lfnm gjkmpjdfntk. djpvj;yjcnm ghjcvjnhtnm ntrcn rfrjuj-yb,elm bp yb[ (cjjndtncnde.obq crhbgn ds nfr;t cvj;tnt yfqnb yf yfitv rjvgfrn-lbcrt).

bc. 4.

jdsq crhbgn pr-read-dbi.pl ,eltn ytpyfxbntkmyj jnkbxfnmcz jn e;t cjplfyyjuj yfvb pr-list-dbi.pl.

fyysq kbcnbyu yf 98% gj[jlbn yf kbcnbyu 1, [jnz, bvttn ytrjnjhst ytpyfxbntkmyst jnkbxbz:

  • gjlrk.xtyf ,b,kbjntrf CGI lkz cxbnsdfybz gfhfvtnhf id (9) bp cnhjrb pfghjcf (yfghbvth, http://localhost/cgi-bin/pr-content-dbi.pl?id=1);
  • ghbvtyztncz dctuj jlby HTML-if,kjy (pr-content-tpl.htm);
  • pfghjc r ,fpt lfyys[ ljgjkyty eckjdysv SQL-jgthfnjhjv WHERE lkz ds,jhrb dct[ lfyys[, cjjndtncnde.ob[ jghtltktyyjve ghtcc-htkbpe gj bltynbabrfnjhe col_id;
  • bp nfr;t cxbnsdftncz gjkt col_body c ntrcnjv ds,hfyyjuj ghtcc-htkbpf.

jplfybt yjdjuj ghtcc-htkbpf

fcibhbv aeyrwbjyfkmyjcnm yfitq cbcntvs, lj,fdbd djpvj;yjcnm cjplfybz yjds[ ghtcc-htkbpjd, ,tp ytj,[jlbvjcnb ytgjchtlcndtyyjq hf,jns c ,fpjq lfyys[ lkz gjgjkytybz nf,kbws tbl_news_items yjdjq byajhvfwbtq.

nfr, yjdfz Perl-ghjuhfvvf (rjnjhfz, rfr b ghtlsleobt ldt, yf[jlbncz yf rjvgfrn-lbcrt) ,eltn jnkbxfnmcz jn ghtlsleob[ ght;lt dctuj ntv, xnj ghtlyfpyfxtyf yt lkz jnj,hf;tybz lfyys[, f lkz b[ lj,fdktybz d . ktljdfntkmyj, vs ljk;ys ytcrjkmrj bpvtybnm xfcnm, jndtxf.oe. pf dpfbvjltqcndbt c , ghbvtybd SQL-pfghjc INSERT b cjjndtncnde.obt tve jgthfnjhs vjlekz DBI.

nhjrb 12-18 'nj ntkj jcyjdyjq ghjuhfvvs:

12. if ($cmd ne "add") {
13. &show_form;
14. } else {
15. $dbh = DBI->connect(dbi:mysql:db_website, _
root,); 
16. &add_pr;
17. dbh->disconnect;
18. }

ltcm vs ghjdthztv, gjcnegbkf kb rjvfylf yf lj,fdktybt ghtcc-htkbpf d ,fpe lfyys[. fr njkmrj jyf gjcnegbkf, ecnfyfdkbdftv cjtlbytybt c (15), dsgjkyztv gjlghjuhfvve app_pr() (16) b pfdthiftv cjtlbytybt (17). ckb ;t rjvfyls yt ,skj, nj ghjcnj jnj,hf;ftv ajhve pfgjkytybz (13) lkz lfyys[ ghtcc-htkbpf ghjwtlehf show_form().

nhjrb 20-36 'nj ntkj ghjwtlehs lj,fdktybz ghtcc-htkbpf pr_add():

19. 
20. sub add_pr {
21. $title = $q->param("pr_title");
22. $author = $q->param("pr_author");
23. $body = $q->param("pr_body");
24. $body =~ s/rn/
/g;
25. 
26. my($sql) = "INSERT INTO tbl_news_items 
(col_title,col_author,col_body,col_date) 
 VALUES ($title,$author,$body,CURDATE())";
27. $rs = $dbh->do($sql); 
28. 
29. if ($@) { 
30. $rc = $dbh->rollback;
31. } else {
32. $rc = $dbh->commit;
33. }
34. 
35. print "Location: /cgi-bin/pr-list-dbi.plnn"; 
36. }

gthdf j,hf,fnsdftv lfyyst ajhvs (22-25), cjcnfdkztv SQL-pfghjc (27) b dsgjkyztv tuj (27) c gjvjom. DBI-vtnjlf $dbh->do(). jcrjkmre pltcm ghjbpdjlbncz ghjwtlehf dcnfdrb lfyys[ d , nj ye;yj gjpf,jnbnmcz j djpvj;yjcnb jnvtys jgthfwbb d ckexft c,jtd. kz 'njuj vs dcnfdbkb rjl jnvtys nhfypfrwbb b jnrfnf d ghtlsleott cjcnjzybt (30-34). hb c,jt ghb dsgjkytybb $dbh->do() jnvtyztv cltkfyyst bpvtytybz (31). ckb ;t c,jz yt ghjbpjikj, nj gjlndth;lftv cltkfyyst bpvtytybz (33). fktt gjckt dct[ ltqcndbq ghjcnj gtht[jlbv yf cnhfybwe cj cgbcrjv dct[ ghtcc-htkbpjd (36).

nhjrb 37-55 'nj ntkj ghjwtlehs dsdjlf ajhvs lkz ddjlf byajhvfwbb j yjdjv ghtcc-htkbpt (bcgjkmpetncz HTML-if,kjy, bvz rjnjhjuj pflfyj d gthtvtyyjq $TPL_INSERT, pr-add-tpl.htm):

37. 
38. sub show_form {
39. print "Content-type:text/htmlnn";
40. 
41. open (L, "$TPL_INSERT");
42. while ($line=) {
43. chomp($line);
44. if ($line=~/@/) {
45. if ($line=~/@ADD@/) {
46. $toadd = "pr-add-dbi.pl";
47. $line =~ s/@ADD@/$toadd/;
48. } else { 
49. $tolist = "pr-list-dbi.pl";
50. $line =~ s/@LIST@/$tolist/;
51. }
52. }
53. print "$linen"; 
54. }
55. close(L);

thtuheprf cbcntvs

jcrjkmre ds hfphf,fnsdftnt lbyfvbxtcrbq Web-cfqn, nj cjjndtncndtyyj rjkbxtcndj byajhvfwbb yf ytv vj;tn hfcnb dtcmvf ,scnhj. hjvt njuj, gj vtht hjcnf gjgekzhyjcnb dfituj htcehcf hfcntn b xbckj tuj gjctnbntktq, xnj vj;tn ghbdtcnb r gthtuheprfv cthdthf, nj tcnm r gjyb;tyb. ghjbpdjlbntkmyjcnb cbcntvs. thtl ntv rfr yfxfnm gjbcrb gentq edtkbxtybz vjoyjcnb fggfhfnys[ chtlcnd b gsnfnmcz yfqnb rjyabuehfwb. yjdjq cbcntvs, vj;yj gjghj,jdfnm ecnhfybnm jlye bp djpvj;ys[ ghbxby xhtpvthyjuj gjnht,ktybz jgthfnbdyjq gfvznb. byjdybrjv vj;tn jrfpfnmcz njn ;t Perl. tkj d njv, xnj rf;lsq hfp ghb j,hfotybb r njve bkb byjve Perl-crhbgne, Web-cthdth pfuhe;ftn bynthghtnfnjh d jgthfnbdye. gfvznm (jy pfybvftn jn 500-1000 ,fqn yf ;tcnrjv lbcrt), f gjcktlybq hfp,bhftn ghjuhfvve jn yfxfkf lj rjywf d gjbcrf[ cbynfrcbxtcrb[ jib,jr. jckt 'njuj jy dyjdm xbnftn tt, bybwbfkbpbhez gthtvtyyst b aeyrwbb, cxbnsdftn ddjlbvst lfyyst (gfhfvtnhs), j,hf,fnsdftn b djpdhfoftn htpekmnfns. htlcnfdkztnt, xnj ghjbc[jlbn, tckb jlyjdhtvtyyj ghtcc-htkbps [jnzn ghjcvjnhtnm cjnyb gjctnbntktq dfituj cfqnf?

kz ecrjhtybz 'njuj ghjwtccf cjplfys cgtwbfkmyst htitybz, ghtlcnfdkz.obt cj,jq ljgjkybntkmyst vjlekb lkz Web-cthdthf Apache mod_fastcgi b mod_perl.

jlekm FastCGI (mod_fastcgi) ghtlgjkfuftn ibhjrjt ghbvtytybt chtlcnd j,vtyf lfyysvb vt;le hf,jnf.obvb ghjwtccfvb (pflfxfvb) jgthfwbjyyjq cbcntvs. yfxfkt cdjtq hf,jns Web-cthdth frnbdbhetn CGI-ghjuhfvve b jcnfdkztn 'ne ghjuhfvve b ytcrjkmrj tt rjgbq hf,jnf.obvb d ajyjdjv ht;bvt. .,st pfghjcs r ghjuhfvvt ,elen ghjcnj gthtlfys e;t frnbdysv rjgbzv, xnj bp,fdbn cthdth jn ljgjkybntkmyjq yfuheprb, cdzpfyyjq c gjdnjhyjq frnbdfwbtq ghjwtccf.

jlekm mod_perl gjpdjkztn pfuhepbnm Perl d jgthfnbdye. gfvznm d nj ;t flhtcyjt ghjcnhfycndj, xnj b cfv Web-cthdth Apache, b jcnfdbnm Perl d gfvznb lj pfdthitybz hf,jns gjcktlytuj, yt gjpdjkzz pfuhe;fnm jxthtlye. rjgb. bynthghtnfnjhf ghb j,hfotybb r CGI-ghjuhfvvt. njn vjlekm ghbvtyztncz xfot, xtv FastCGI, gjcrjkmre yt nht,etn ybrfrb[ bpvtytybq d ghjuhfvvt.

jgjkybntkmyfz byajhvfwb

Apache

Apache gjpbwbjybhetncz yf hsyrt rfr vjoysq b ub,rbq Web-cthdth, cjdvtcnbvsq cj cnfylfhnjv HTTP/1.1. hbvthyj 60% dct[ Web-cthdthjd d ynthytnt aeyrwbjybhe.n gjl eghfdktybtv Apache. eyrwbjyfkmyjcnm Apache vj;yj kturj edtkbxbnm, ecnfyjdbd cdj,jlyj hfcghjcnhfyztvst vjlekb hfcibhtybz. c[jlyst rjls 'njuj Web-cthdthf ljcnegys ghfrnbxtcrb lkz k.,jq gkfnajhvs. ot jlyjq tuj gjktpyjq jcj,tyyjcnm. zdkztncz njn afrn, xnj Apache gjpdjkztn hf,jnfnm c vyj;tcndjv zpsrjd ghjuhfvvbhjdfybz, f nfr;t pfuhe;fnm ytrjnjhst bp yb[ d cdjt flhtcyjt ghjcnhfycndj, edtkbxbdfz nfrbv j,hfpjv crjhjcnm dpfbvjltqcndbz ynthytn-gjkmpjdfntkz c cbcntvjq.

MySQL

MySQL rhjcc-gkfnajhvtyyfz cbcntvf eghfdktybz htkzwbjyysvb ,fpfvb lfyys[ (RDBMS, Relational DataBase Management System) c bcgjkmpjdfybtv zpsrf pfghjcjd SQL (Structured Query Language). yfxfkf MySQL, rfr b Apache b lf;t Perl, dsgecrfkfcm njkmrj d dthcbb lkz UNIX-cbcntv, gj'njve lj cb[ gjh cj[hfyztn bynthatqc rjvfylyjq cnhjrb. lyfrj pf gjcktlytt dhtvz dsgeotyj juhjvyjt rjkbxtcndj uhfabxtcrb[ vtytl;thjd, rjnjhst j,ktuxf.n pflfxb flvbybcnhbhjdfybz. hjvt njuj, d gjcnfdre MySQL lkz Linux b Windows d[jlbn vtytl;th, uhfabxtcrbq bynthatqc rjnjhjuj c[j; c ntv, xnj bcgjkmpetn jrjyysq vtytl;th KDE d j,jkjxrt X Window Linux.

Perl, bkb PERL

PERL (Practical Extraction and Report Language) zpsr, rjnjhsq ,sk hfphf,jnfy ukfdysv j,hfpjv lkz cbynfrcbxtcrjq j,hf,jnrb ntrcnf. lyfrj d gjcktlybt ytcrjkmrj ktn ,kfujlfhz yjdsv b vjlekzv hfcibhtybz, jy ghbvtyztncz yt njkmrj rfr ntrcnjdsq j,hf,jnxbr, yj b rfr vjoysq bycnhevtyn hfphf,jnrb ynthytn/ynhfytn-ghbkj;tybq b Web-hj,jnjd. ynthghtnfnjh Perl gjcnfdkztncz, rfr ghfdbkj, dvtcnt c bc[jlysvb rjlfvb, rjnjhst vjuen ,snm crjvgbkbhjdfys ghfrnbxtcrb yf k.,jq gkfnajhvt DOS, OS/2, UNIX bkb Windows.

jktpyst ccskrb

Apache:

http://www.apache.ru/
http://apache.lexa.ru/
http://www.apache.org/

MySQL:

http://www.mysql.com/
http://www.mysql.ru/

Perl:

http://www.perl.org/
http://www.perl.com/
http://perl.oreilly.com/
http://www.activestate.com/
ftp://ftp.activestate.com/
http://www.cpan.org/
http://www.perl.ru/

citforum.ru/internet/articles/dyn_web.shtml b[fbk dljrbvjd jvgm.nthhtcc

3
  ,
:
. +7(98I) 7608865

e-mail
icq 415547094  romver  mail.ru  romverinbox.ru
1997 - 2022 romver.ru

Display Pagerank