PHP-AdvancedTutorialGulevDecember6,2002.
Veracruz,MexicoRasmusLerdorfhttp://lerdorf.
com/veracruz.
pdfSlide1/64December6,2002AgendaoPHP-MySQLoCookieHandlingoDynamicImagesoPDFoFlashoSessionsoSecurityoTips&TricksoOptimizationoLatestDevelopmentsoFuture-2-Slide2/64December6,2002SetupCheckyourPHPSetupforMySQLsupportIfnotenabledVeryraresinceaMySQLclientlibraryisdistributedwithPHPandbuiltintoPHPbydefault.
However,itispossibletobuildPHPwithoutMySQLsupport.
Somepossiblefixes:apt-getinstallphp-mysqlrpm-Uvhphp-mysql-4.
2.
2-1.
i386.
rpm.
/configure--with-mysql=shared,/usrcpmodules/mysql.
so/usr/local/lib/phpextension_dir=/usr/local/lib/phpextension=mysql.
so-3-Slide3/64December6,2002SanityCheckMakesureMySQLisrunningprompt:~>mysqlshow|Databases||mysql||test|OrwiththelatestPHPOutput:Uptime:6717Threads:1Questions:1Slowqueries:0Opens:6Flushtables:1Opentables:0Queriespersecondavg:0.
000-4-Slide4/64December6,2002ConnectingtoMySQLThesimpleconnectionOutput:Resourceid#28Othervariations-5-Slide5/64December6,2002PersistentConnectionsThesimpleconnectionOutput:Resourceid#31CaveatsoWatchoutformulti-credentialconnectionsoMakesureyoumatchupmax_connectionsandMaxClients-6-Slide6/64December6,2002CreatingaDatabaseCreateaDBOutput:DatabasefoocreatedCreateaTableOutput:Tablecreated-7-Slide7/64December6,2002InsertingDataINSERTQuery";}else{echomysql_error().
"";}}mysql_connect('localhost');mysql_select_db('foo');add_user('rasmus','foobar','RasmusLerdorf','rasmus@php.
net');add_user('carl','carlspass','CarlAlexandeRLerdorf','carl@lerdorf.
com');>Output:RowinsertedRowinserted-8-Slide8/64December6,2002SelectingDataSELECTQuery\n";}}>Output:rasmus-aVOtbUF2LODnw-RasmusLerdorf-rasmus@php.
net-20021206142646carl-aVOnaDJh48k7o-CarlAlexandeRLerdorf-carl@lerdorf.
com-20021206142646mysql_fetch_array()\n";}}>Output:carl-aVOnaDJh48k7o-CarlAlexandeRLerdorf-carl@lerdorf.
com-20021206142646rasmus-aVOtbUF2LODnw-RasmusLerdorf-rasmus@php.
net-20021206142646-9-Slide9/64December6,2002DealingwithtimestampsUsingDATE_FORMAT\n";}}else{echomysql_error();}>Output:rasmus-rasmus@php.
net-FridayDecember6th,200202:26:46PMcarl-carl@lerdorf.
com-FridayDecember6th,200202:26:46PM-10-Slide10/64December6,2002ChangingExistingRowsUsingUPDATEOutput:1REPLACEINTOYoucanalsouseREPLACEINTOtoupdatearowifitexistsandinsertitifitdoesn't.
-11-Slide11/64December6,2002MagicQuotesEscapingtroublesomecharactersWhenyouareinsertingdataintoaMySQLdatabase,certaincharactershaveaspecialmeaningandmustthereforebeescapedifyouwishtoinsertthesecharactersliterally.
Bydefault,PHPwillescapethesecharactersforyouinanydatacomingfromtheuserinGET,PostorCookiedata.
ThismagicescapingisknownasMagicQuotesandcanbeconfiguredinyourphp.
inifilebysettingthemagic_quotes_gpcdirective.
Thecharactersaffectedare\'"andNUL(char0).
Ifthesecharactersappearinuser-supplieddatatheywillbeescapedwitha\(backslash).
Somepeopleprefertoturnthisfeatureoffandhandleescapingdatamanuallyusingtheaddslashes()function.
Thereisaconversefunction,stripslashes(),whichremovesthebackslashcharactersinanescapedstring.
-12-Slide12/64December6,2002ASimpleGuestbookGuestbookExampleAverysimpleguestbookexampletoillustratebasicfilehandling.
MyGuestbookWelcometomyGuestbookPleasewritemealittlenotebelow"method="POST">');fclose($fp);}>Theentriessofar:Output:MyGuestbookWelcometomyGuestbookPleasewritemealittlenotebelowTheentriessofar:-13-Slide13/64December6,2002DB-drivenGuestbookSQL'izingtheGuestbookExampleWearegoingtoconvertthisintoanSQL-drivenguestbookbyfirstcreatingadatabase,thenaschemaforthetablewherewewillstorethedataandthenwewillmodifythecode.
CreateadatabasemysqladmincreatemydbCreateaSchemaCREATETABLEcomments(idint(8)DEFAULT'0'NOTNULLauto_increment,commenttext,tsdatetime,PRIMARYKEY(id));-14-Slide14/64December6,2002DB-drivenGuestbookSQL'izingtheGuestbookExampleHereweaddthenecessarycodetostoreourguestbookcommentsinanSQLdatabaseMyGuestbookWelcometomyGuestbookPleasewritemealittlenotebelow"method="POST">Theentriessofar:\n";}>Output:MyGuestbookWelcometomyGuestbookPleasewritemealittlenotebelowTheentriessofar:-15-Slide15/64December6,2002DBAbstractionAdatabaseabstractionlayerisbundledwithPHP4.
Intheexamplebelow,theonlythingyouwouldneedtochangetouseadifferentdatabaseistheodbcwordonthethirdline.
prepare('SELECT*FROMcomments');$result=$db->execute($stmt);while($row=$db->fetchrow($result)){while($rowas$field=>$value){echo"$field:$value\n";}}$db->disconnect();>-16-Slide16/64December6,2002HTTPHeadersYoucanaddheaderstotheHTTPresponseinPHPusingtheHeader()function.
Sincetheresponseheadersaresentbeforeanyoftheactualresponsedata,youhavetosendtheseheadersbeforeoutputtinganydata.
So,putanysuchheadercallsatthetopofyourscript.
RedirectionSettingaLast-ModifiedHeaderAvoidallCaching-17-Slide17/64December6,2002CookiesSettingaSessionCookieSettingaPersistentCookieReadingaCookieDeletingtheCookiesOtherOptionalParamtersPath,Domain,andSecureparameterscanalsobesettorestrictacookietoacertainpath,domainorinthecaseoftheSecureparameter,limitthecookietoonlybesetiftherequestcameinoveranSSLconnection.
-18-Slide18/64December6,2002CookieExpiryProblemShortexpirycookiesdependonusershavingtheirsystemclockssetcorrectly.
SolutionDon'tdependontheusershavingtheirclockssetright.
Embedthetimeoutbasedonyourserver'sclockinthecookie.
Thenwhenyoureceivethecookie,decodeitanddetermineifitisstillvalid.
-19-Slide19/64December6,2002GD1/2CreatingaPNGwithaTrueTypefont">!
-20-Slide20/64December6,2002ColoursColorHandlingForimageswithan8-bitindexedpaletteitcanbetrickytomanagecolors.
Output:Forpalettedimagesthefollowingfunctionscanbeuseful:oImageColorClosestoImageColorExactoImageColorDeallocate-21-Slide21/64December6,2002ColoursColourHandlingForTruecolorimageswehavenosuchissues.
Output:-22-Slide22/64December6,2002TruecolorColorsTruecolorcolorhandlingForTruecolorimagesthecolorsareactuallysimple31-bitlongs.
Or,thinkofthemasbeingcomposedof4bytesarrangedlikethis:Thehighestorleftmostbitinthealphachannelisnotusedwhichmeansthealphachannelcanonlyhavevaluesfrom0to127.
YoucanusetheImageColorAllocate()aswithpalettedimages,butyoucanalsospecifythecolordirectly.
Forexample:Output:Thisexamplecouldalsobewrittenlikethis:-24-Slide23/64December6,2002TruecolorColorsTruecolorColorHandlingGiventhenatureofthewaytruecolorcolorsareconstructed,wecanrewriteourcolortestingstripusingPHP'sbitshiftoperator:Output:-25-Slide24/64December6,2002ImageColorAtUsingImageColorAt()">#",$rgb['red'],$rgb['green'],$rgb['blue']);}echo"\n";}imagedestroy($im);>Output:-26-Slide25/64December6,2002GD1/2CreateFromandBoundingBoxMath&si=">Text:Size:!
-27-Slide26/64December6,2002TextBuilt-inFontsGDcomeswith5built-infonts.
Theyaren'tallthatuseful.
Output:-28-Slide27/64December6,2002TTFTextTrueTypeFontsYoucanuseanyTrueTypeFontthatincludesaUnicodemappingtable.
FontssuchasWingdingswillnotwork.
Output:-29--30-Slide28/64December6,2002EXIFReadingEXIFHeadersfromaJPEG$val){if(is_array($val)){foreach($valas$k=>$v){echo$key.
"[$k]:$v\n";}}elseecho"$key:".
@substr($val,0,40).
"\n";}>Output:FileName:img_resize.
jpgFileDateTime:1027351588FileSize:669158FileType:2MimeType:image/jpegSectionsFound:ANY_TAG,IFD0,THUMBNAIL,EXIFCOMPUTED[html]:width="1536"height="1024"COMPUTED[Height]:1024COMPUTED[Width]:1536COMPUTED[IsColor]:1COMPUTED[ByteOrderMotorola]:0COMPUTED[ApertureFNumber]:f/4.
0COMPUTED[FocusDistance]:1.
07mCOMPUTED[Thumbnail.
FileType]:8COMPUTED[Thumbnail.
MimeType]:image/tiffCOMPUTED[Thumbnail.
Height]:64COMPUTED[Thumbnail.
Width]:96Make:EastmanKodakCompanyModel:KODAKDC265ZOOMDIGITALCAMERA(V01.
00)Orientation:1XResolution:150/1YResolution:150/1ResolutionUnit:2YCbCrPositioning:1Exif_IFD_Pointer:190THUMBNAIL[ImageWidth]:96THUMBNAIL[ImageLength]:64THUMBNAIL[BitsPerSample]:ArrayTHUMBNAIL[Compression]:1THUMBNAIL[PhotometricInterpretation]:2THUMBNAIL[StripOffsets]:1748THUMBNAIL[Orientation]:1THUMBNAIL[SamplesPerPixel]:3THUMBNAIL[RowsPerStrip]:64THUMBNAIL[StripByteCounts]:18432THUMBNAIL[XResolution]:72/1THUMBNAIL[YResolution]:72/1THUMBNAIL[PlanarConfiguration]:1THUMBNAIL[ResolutionUnit]:2ExposureTime:1/250FNumber:400/100ExifVersion:0200DateTimeOriginal:1999:01:3104:17:59ComponentsConfiguration:Fetchinganembeddedthumbnail-32-Slide29/64December6,2002PDFson-the-flyAPDFInvoice'595x842','letter'=>'612x792','legal'=>'612x1008');if(!
isset($type))$type='letter';list($x,$y)=explode('x',$sizes[$type]);$items=array(array('Ourspeciallow-costwidgetthatdoeseverything','299.
99'),array('Ourspecialhigh-costwidgetthatdoesmore','1899'),array('Abluewidget','29.
95'),array('Andaredwidget','49.
95'),array('Ayellowwidgetthatmakesnoise','49.
9'),array('Andonethatdoesn\'t','999.
95'),);pdf_begin_page($pdf,$x,$y);$im=pdf_open_jpeg($pdf,"php-big.
jpg");pdf_place_image($pdf,$im,5,$y-72,0.
5);pdf_close_image($pdf,$im);pdf_set_value($pdf,'textrendering',0);//fillpdf_set_font($pdf,"Helvetica",12,winansi);pdf_show_xy($pdf,'GenericEvilCompanyInc.
',145,$y-20);pdf_continue_text($pdf,'123MainStreet');pdf_continue_text($pdf,'DarkCity,CA98765');pdf_set_font($pdf,"Helvetica",10,winansi);pdf_show_xy($pdf,'HelplessCustomerLtd.
',20,$y-100);pdf_continue_text($pdf,'2SmallStreet');pdf_continue_text($pdf,'LittleTown,ID56789');pdf_set_font($pdf,"Helvetica",10,winansi);pdf_show_xy($pdf,'Terms:Net30',150,$y-100);pdf_continue_text($pdf,'PO#:12345');pdf_set_font($pdf,"Helvetica-Bold",30,winansi);pdf_show_xy($pdf,"*INVOICE*",$x-250,$y-112);pdf_setcolor($pdf,'fill','gray',0.
9,0,0,0);pdf_rect($pdf,20,80,$x-40,$y-212);pdf_fill_stroke($pdf);$offset=184;$i=0;while($y-$offset>80){pdf_setcolor($pdf,'fill','gray',($i%2)0.
8:1,0,0,0);pdf_setcolor($pdf,'stroke','gray',($i%2)0.
8:1,0,0,0);pdf_rect($pdf,21,$y-$offset,$x-42,24);pdf_fill_stroke($pdf);$i++;$offset+=24;}pdf_setcolor($pdf,'fill','gray',0,0,0,0);pdf_setcolor($pdf,'stroke','gray',0,0,0,0);pdf_moveto($pdf,20,$y-160);pdf_lineto($pdf,$x-20,$y-160);-33-pdf_stroke($pdf);pdf_moveto($pdf,$x-140,$y-160);pdf_lineto($pdf,$x-140,80);pdf_stroke($pdf);pdf_set_font($pdf,"Times-Bold",18,winansi);pdf_show_xy($pdf,"Item",30,$y-150);pdf_show_xy($pdf,"Price",$x-100,$y-150);pdf_set_font($pdf,"Times-Italic",15,winansi);$offset=177;foreach($itemsas$item){pdf_show_xy($pdf,$item[0],30,$y-$offset);pdf_show_boxed($pdf,'$'.
number_format($item[1],2),$x-55,$y-$offset,0,0,'right');$offset+=24;$total+=$item[1];}pdf_set_font($pdf,"Times-Bold",17,winansi);$offset+=24;pdf_show_xy($pdf,'Total',30,$y-$offset);pdf_show_boxed($pdf,'$'.
number_format($total,2),$x-55,$y-$offset,0,0,'right');pdf_end_page($pdf);pdf_close($pdf);$data=pdf_get_buffer($pdf);header('Content-type:application/pdf');header("Content-disposition:inline;filename=invoice.
pdf");header("Content-length:".
strlen($data));echo$data;>Output:-34-Slide30/64December6,2002Ming-FlashSeehttp://www.
opaque.
net/ming/getWidth();$h=$jpg->getHeight();$f=$s->addFill($jpg);$f->moveTo(-$w/2,-$h/2);$s->setRightFill($f);$s->movePenTo(-$w/2,-$h/2);$s->drawLine($w,0);$s->drawLine(0,$h);$s->drawLine(-$w,0);$s->drawLine(0,-$h);$p=newSWFSprite();$i=$p->add($s);for($step=0;$stepnextFrame();$i->rotate(-2);}$m=newSWFMovie();$i=$m->add($p);$i->moveTo(230,120);$m->setRate(100);$m->setDimension($w*1.
8,$h*1.
8);header('Content-type:application/x-shockwave-flash');$m->output();>Output:-35-Slide31/64December6,2002MoreMingFlash+RSS/XMLparse();$allItems=$r->getItems();$itemCount=count($allItems);$width=1000;$m=newSWFMovie();$m->setDimension($width,70);$m->setBackground(0xcf,0xcf,0xcf);$f=newSWFFont(fonts/Techno.
fdb");$hit=newSWFShape();$hit->setRightFill($hit->addFill(0,0,0));$hit->movePenTo(-($width/2),-30);$hit->drawLine($width,0);$hit->drawLine(0,60);$hit->drawLine(-$width,0);$hit->drawLine(0,-60);$x=0;//buildthebuttonsforeach($allItemsas$Item){$title=$Item['title'];$link=$Item['link'];//getthetext$t=newSWFText();$t->setFont($f);$t->setHeight(50);$t->setColor(0,0,0);$t->moveTo(-$f->getWidth($title)/2,25);$t->addString($title);//makeabutton$b[$x]=newSWFButton();$b[$x]->addShape($hit,SWFBUTTON_HIT);$b[$x]->addShape($t,SWFBUTTON_OVER|SWFBUTTON_UP|SWFBUTTON_DOWN);$b[$x++]->addAction(newSWFAction("getURL('$link','_new');"),SWFBUTTON_MOUSEUP);}//displaythemfor($x=0;$xadd($b[$x]);$i->moveTo($width/2,30);for($j=0;$jscaleTo(sqrt(sqrt($j/30)));$i->multColor(1.
0,1.
0,1.
0,$j/30);$m->nextFrame();}for($j=0;$jscaleTo(sqrt(sqrt(1+($j/30))));$i->multColor(1.
0,1.
0,1.
0,(30-$j)/30);$m->nextFrame();}-36-$m->remove($i);}header('Content-type:application/x-shockwave-flash');$m->output();>Output:-37-Slide32/64December6,2002Cool!
Super-coolDynamicImageGeneratorWanttobecoolerthanallyourfriendsWellhereitis!
First,setupanErrorDocument404handlerforyourimagesdirectory.
ErrorDocument404/images/generate.
php')Thengenerate.
phplookslikethis:TheURL,http://localhost/images/button_test_000000.
pngproducesthisimage:-39-Slide33/64December6,2002SessionsStartingaSessionTostartasessionusesession_start()andtoregisteravariableinthissessionusethe$_SESSIONarray.
Ifregister_globalsisenabledthenyoursessionvariableswillbeavailableasnormalvariablesonsubsequentpages.
Otherwisetheywillonlybeinthe$_SESSIONarray.
-40-Slide34/64December6,2002SessionConfigurationDefaultsessionsettingsaresetinyourphp.
inifile:session.
save_handler=files;Flatfilebackendsession.
save_path=/tmp;wheretostoreflatfilessession.
name=PHPSESSID;Nameofsession(cookiename)session.
auto_start=0;initsessiononreqstartupsession.
use_cookies=1;whethercookiesshouldbeusedsession.
use_only_cookies=0;forceonlycookiestobeusedsession.
cookie_lifetime=0;0=sessioncookiesession.
cookie_path=/;pathforwhichcookieisvalidsession.
cookie_domain=;thecookiedomainsession.
serialize_handler=php;serializationhandler(wddx|php)session.
gc_probability=1;garbagecollectionprob.
session.
gc_dividend=100;If100,thenaboveisin%session.
gc_maxlifetime=1440;garbagecollectionmaxlifetimesession.
referer_check=;filteroutexternalURL\'ssession.
entropy_length=0;#ofbytesfromentropysourcesession.
entropy_file=;addtionalentropysourcesession.
use_trans_sid=1;useautomaticurlrewritingurl_rewriter.
tags="a=href,area=href,frame=src,input=src"session.
cache_limiter=nocache;Setcache-controlheaderssession.
cache_expire=180;expiryforprivate/publiccachingCache-controlisimportantwhenitcomestosessions.
Youhavetobecarefulthatend-userclientcachesaren'tcachinginvalidpagesandalsothatintermediaryproxy-cachemechanismsdon'tsneakinandcachepagesonyou.
Whencache-limiterissettothedefault,no-cache,PHPgeneratesasetofresponseheadersthatlooklikethis:HTTP/1.
1200OKDate:Sat,10Feb200110:21:59GMTServer:Apache/1.
3.
13-dev(Unix)PHP/4.
0.
5-devX-Powered-By:PHP/4.
0.
5-devSet-Cookie:PHPSESSID=9ce80c83b00a4aefb384ac4cd85c3daf;path=/Expires:Thu,19Nov198108:52:00GMTCache-Control:no-store,no-cache,must-revalidate,post-check=0,pre-check=0Pragma:no-cacheConnection:closeContent-Type:text/htmlForcache_limiter=privatethecacherelatedheaderslooklikethis:Set-Cookie:PHPSESSID=b02087ce4225987870033eba2b6d78c3;path=/Expires:Thu,19Nov198108:52:00GMTCache-Control:private,max-age=10800,pre-check=10800Forcache_limiter=publictheylooklikethis:Set-Cookie:PHPSESSID=37421e3d0283c667f75481745b25b9ad;path=/Expires:Tue,12Feb200113:57:16GMTCache-Control:public,max-age=10800-41-Slide35/64December6,2002CustomBackendYoucanchangethesessionbackenddatastorefromascriptusingsession_module_name().
Youcanalsodefineyourowncustomsessionbackenddatastoreusingthesession_set_save_handler()function.
Youwouldthenwritethese6functions.
-42-Slide36/64December6,2002CustomBackendLet'shavealookatanactualcustomsessionbackend.
ThisusesMySQLtostorethesessiondata.
Wecouldsettheserightinthescript,butlet'smakeuseofApache'shttpd.
conffiletosetourcustomsavehandlerforaportionofourwebsite.
php_valuesession.
save_handleruserphp_valuesession.
save_pathmydbphp_valuesession.
namesessionsTheMySQLschemalookslikethis:CREATETABLEsessions(idchar(32)NOTNULL,datatext,tstimestamp,PRIMARYKEY(id))Wecannowwriteourhandler.
Itlookslikethis:OurPHPfilesunder/var/html/testthensimplyneedtolooksomethinglikethis:-44-Slide37/64December6,2002register_globalsPHPautomaticallycreatesglobalvariablescontainingdatafromavarietyofexternalsources.
Thisfeaturecanbeturnedoffbyturningofftheregister_globalssetting.
Withregister_globalsyoucanaccessthisdataviaanumberofspecialassociativearrayslistedbelow.
$_GET['foo']='bar'http://www.
php.
net/index.
phpfoo=bar$_POST['foo']='bar'$_COOKIE['foo']='bar'$_REQUEST['foo']='bar'$_SERVERSpecialvariablessetbyyourwebserver.
Youcangetalistofwhatissetbyrunningthiscodeonyourserver:$val){echo'$_SERVER['.
$key.
"]=$val\n";}>$_SERVER[DOCUMENT_ROOT]=/home/rasmus/phpweb$_SERVER[HTTP_ACCEPT]=text/xml,application/xml,application/xht.
.
.
$_SERVER[HTTP_ACCEPT_CHARSET]=ISO-8859-1,utf-8;q=0.
66,*;q=0.
66$_SERVER[HTTP_ACCEPT_ENCODING]=gzip,deflate,compress;q=0.
9$_SERVER[HTTP_ACCEPT_LANGUAGE]=en-us,en;q=0.
50$_SERVER[HTTP_CACHE_CONTROL]=max-age=0$_SERVER[HTTP_CONNECTION]=keep-alive$_SERVER[HTTP_COOKIE]=dims=1014_690;PHPSESSID=c1c486d22f970af.
.
.
$_SERVER[HTTP_HOST]=localhost$_SERVER[HTTP_KEEP_ALIVE]=300$_SERVER[HTTP_REFERER]=http://localhost/pres2/index.
php/PHP$_SERVER[HTTP_USER_AGENT]=Mozilla/5.
0(X11;U;Linuxi686;en-US;.
.
.
$_SERVER[PATH]=/usr/local/bin:/bin:/usr/bin:/usr/sbin:/.
.
.
$_SERVER[REMOTE_ADDR]=127.
0.
0.
1$_SERVER[REMOTE_PORT]=1099$_SERVER[SCRIPT_FILENAME]=/home/rasmus/phpweb/pres2/show.
php$_SERVER[SERVER_ADDR]=127.
0.
0.
1$_SERVER[SERVER_ADMIN]=rasmus@lerdorf.
com$_SERVER[SERVER_NAME]=localhost$_SERVER[SERVER_PORT]=80$_SERVER[SERVER_SIGNATURE]=Apache/1.
3.
28-devServeratlocalhostPo.
.
.
$_SERVER[SERVER_SOFTWARE]=Apache/1.
3.
28-dev(Unix)PHP/4.
4.
0-dev$_SERVER[GATEWAY_INTERFACE]=CGI/1.
1$_SERVER[SERVER_PROTOCOL]=HTTP/1.
1-45-$_SERVER[REQUEST_METHOD]=GET$_SERVER[QUERY_STRING]=$_SERVER[REQUEST_URI]=/pres2/show.
php/veracruz$_SERVER[SCRIPT_NAME]=/pres2/show.
php$_SERVER[PATH_INFO]=/veracruz$_SERVER[PATH_TRANSLATED]=/home/rasmus/phpweb/veracruz$_SERVER[PHP_SELF]=/pres2/show.
php/veracruz$_SERVER[argv]=Array$_SERVER[argc]=0$_ENVEnvironmentvariablesthatwerepresentatserverstartuptime.
NotethatenvironmentvariablescreatedbyPHPusingputenv()willnotbeshownhere,nordotheypersistbeyondtherequest.
$_ENV[MANPATH]=/usr/man:/usr/local/man:/usr/share/man$_ENV[SUPPORTED]=en_US:en$_ENV[SSH_AGENT_PID]=855$_ENV[HOSTNAME]=thinkpad.
lerdorf.
com$_ENV[HOST]=thinkpad.
lerdorf.
com$_ENV[TERM]=xterm$_ENV[SHELL]=/bin/tcsh$_ENV[GTK_RC_FILES]=/etc/gtk/gtkrc:/home/rasmus/.
gtkrc-1.
2-g.
.
.
$_ENV[WINDOWID]=27263119$_ENV[QTDIR]=/usr/lib/qt3-gcc3.
2$_ENV[BK_HOST]=mysql.
com$_ENV[USER]=root$_ENV[GROUP]=rasmus$_ENV[LS_COLORS]=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:s.
.
.
$_ENV[SUDO_USER]=rasmus$_ENV[GDK_USE_XFT]=1$_ENV[SUDO_UID]=500$_ENV[HOSTTYPE]=i386-linux$_ENV[SSH_AUTH_SOCK]=/tmp/ssh-XXpcCouR/agent.
843$_ENV[SESSION_MANAGER]=local/thinkpad.
lerdorf.
com:/tmp/.
ICE-uni.
.
.
$_ENV[PAGER]=/usr/bin/less$_ENV[BK_LICENSE]=ACCEPTED$_ENV[BK_USER]=rasmus$_ENV[PATH]=/usr/local/bin:/bin:/usr/bin:/usr/sbin:/.
.
.
$_ENV[MAIL]=/var/mail/rasmus$_ENV[PWD]=/home/rasmus/phpweb/pres2/presentations$_ENV[XMODIFIERS]=@im=none$_ENV[EDITOR]=vi$_ENV[LANG]=en_US$_ENV[NPROMPT]=%{[34;1m%}%t%m:%~>%{[0m%}>$_ENV[SSH_ASKPASS]=/usr/libexec/openssh/gnome-ssh-askpass$_ENV[SUDO_COMMAND]=/bin/tcsh$_ENV[HOME]=/home/rasmus$_ENV[SHLVL]=5$_ENV[OSTYPE]=linux$_ENV[GNOME_DESKTOP_SESSION_ID]=Default$_ENV[VENDOR]=intel$_ENV[LOGNAME]=root$_ENV[MACHTYPE]=i386$_ENV[MOZILLA_XFT]=1$_ENV[VISUAL]=vi$_ENV[LESSOPEN]=|/usr/bin/lesspipe.
sh%s$_ENV[SUDO_GID]=500$_ENV[DISPLAY]=:0$_ENV[G_BROKEN_FILENAMES]=1$_ENV[COLORTERM]=gnome-terminal$_ENV[XAUTHORITY]=/home/rasmus/.
Xauthority$_ENV[_]=/usr/sbin/httpd$_FILESUsedfortheRFC1867fileuploadfeature.
$_FILES['userfile']['name']-46-$_FILES['userfile']['type']$_FILES['userfile']['size']$_FILES['userfile']['tmp_name']$HTTP_RAW_POST_DATAWhenthemimetypeassociatedwiththePOSTdataisunrecognizedornotset,therawpostdataisavailableinthisvariable.
-47-Slide38/64December6,2002SafeModeSafeModeisanattempttosolvetheshared-serversecurityproblem.
ItisarchitecturallyincorrecttotrytosolvethisproblematthePHPlevel,butsincethealternativesatthewebserverandOSlevelsaren'tveryrealistic,manypeople,especiallyISP's,usesafemodefornow.
Theconfigurationdirectivesthatcontrolsafemodeare:safe_mode=Offopen_basedir=safe_mode_exec_dir=safe_mode_allowed_env_vars=PHP_safe_mode_protected_env_vars=LD_LIBRARY_PATHdisable_functions=Whensafe_modeison,PHPcheckstoseeiftheownerofthecurrentscriptmatchestheownerofthefiletobeoperatedonbyafilefunction.
Forexample:-rw-rw-r--1rasmusrasmus33Jul119:20script.
php-rw-r--r--1rootroot1116May2618:01/etc/passwdRunningthisscript.
phpresultsinthiserrorwhensafemodeisenabled:Warning:SAFEMODERestrictionineffect.
Thescriptwhoseuidis500isnotallowedtoaccess/etc/passwdownedbyuid0in/docroot/script.
phponline2Ifinsteadofsafe_mode,yousetanopen_basedirdirectorythenallfileoperationswillbelimitedtofilesunderthespecifieddirectory.
Forexample(Apachehttpd.
confexample):php_admin_valueopen_basedir/docrootIfyourunthesamescript.
phpwiththisopen_basedirsettingthenthisistheresult:Warning:open_basedirrestrictionineffect.
Fileisinwrongdirectoryin/docroot/script.
phponline2Youcanalsodisableindividualfunctions.
Ifweaddthistoourphp.
inifile:disable_functionsreadfile,systemThenwegetthisoutput:Warning:readfile()hasbeendisabledforsecurityreasonsin/docroot/script.
phponline2-48-Slide39/64December6,2002SecurityWatchforuninitializedvariablesCatchthesebysettingtheerror_reportingleveltoE_ALL.
Theabovescriptwouldgeneratethiswarning(assuming$userisset):Warning:Undefinedvariable:okinscript.
phponline6Youcanofcoursealsoturnoffregister_globals,butthataddressesthesymptomratherthantheproblem.
-49-Slide40/64December6,2002SecurityNevertrustuserdata!
Turningoffregister_globalsdoesn'tmakethisanymoresecure.
Thescriptwouldinsteadlooklikethis:Theonlywaytosecuresomethinglikethisistobereallyparanoidaboutcleaninguserinput.
InthiscaseifyoureallywanttheusertobeabletospecifyafilenamethatgetsusedinanyofPHP'sfilefunctions,dosomethinglikethis:Youmayalsowanttostripoutanypathandonlytakethefilenamecomponent.
Aneasywaytodothatistousethebasename()function.
Orperhapschecktheextensionofthefile.
Youcangettheextensionusingthiscode:-50-Slide41/64December6,2002SecurityAgain,nevertrustuserdata!
Inthisexampleyouwanttomakesurethattheusercan'tpassin$dirsettosomethinglike:".
;cat/etc/passwd"Theremedyistouseescapeshellarg()whichplacestheargumentinsidesinglequotesandescapesanysinglequotecharactersinthestring.
Beyondmakingsureuserscan'tpassinargumentsthatexecutesothersystemcalls,makesurethattheargumentitselfisokandonlyaccessesdatayouwanttheuserstohaveaccessto.
-51-Slide42/64December6,2002SecurityManyusersplacecodeinmultiplefilesandincludethesefiles:OrperhapsBothofthesecanbeproblematiciftheincludedfileisaccessiblesomewhereundertheDOCUMENT_ROOTdirectory.
ThebestsolutionistoplacethesefilesoutsideoftheDOCUMENT_ROOTdirectorywheretheyarenotaccessibledirectly.
Youcanaddthisexternaldirectorytoyourinclude_pathconfigurationsetting.
AnotheroptionistorejectanydirectrequestsforthesefilesinyourApacheconfiguration.
Youcanusearulelikethisinyour"httpd.
conf"file:Orderallow,denyDenyfromall-52-Slide43/64December6,2002SecurityTakethisstandardfileuploadform:Sendthisfile:Thecorrectwaytoputtheuploadedfileintherightplace:IfyouareuploadingfilestobeplacedsomewhereundertheDOCUMENT_ROOTthenyouneedtobeveryparanoidincheckingwhatyouareputtingthere.
Forexample,youwouldn'twanttoletpeopleuploadarbitraryPHPscriptsthattheycanthenbrowsetoinordertoexecutethem.
Herewegetparanoidaboutcheckingthatonlyimagefilescanbeuploaded.
Weevenlookatthecontentsofthefileandensurethatthefileextensionmatchesthecontent.
-53-Slide44/64December6,2002ReferencesReferencesarenotpointers!
-54-Slide45/64December6,2002ReturningReferencesPassingargumentstoafunctionbyreferenceOutput:2Afunctionmayreturnareferencetodataasopposedtoacopy-55-Slide46/64December6,2002AddinganextensionProblemYouneedPHP'sbuilt-inftpfunctionsfortheultra-coolscriptyouarewriting,butyourserviceproviderdoesnothavePHPcompiledwiththe--enable-ftpoption.
SolutionIfyouhaveashellaccountonasystemwiththesameoperatingsystemasyourwebserver,grabthePHPsourcetarballandbuildusing:--with-apxs--enable-ftp=sharedYoucancheckwhichflagsyourproviderusedbyputtingaphpinfo()callinascriptonyourserver.
Oncecompiled,youwillfinda"modules/ftp.
so"filewhichyoucancopytoyourwebserverandenableeitherbyputting:extension=ftp.
soinyourphp.
inifileorbyaddingthistothetopofyourscript:-56-Slide47/64December6,2002$PATH_INFO$PATH_INFOisyourfriendwhenitcomestocreatingcleanURLS.
TakeforexamplethisURL:http://www.
company.
com/products/routersIftheApacheconfigurationcontainsthisblock:ForceTypeapplication/x-httpd-phpThenallyouhavetodoiscreateaPHPscriptinyourDOCUMENT_ROOTnamed'products'andyoucanusethe$PATH_INFOvariablewhichwillcontainthestring,'/routers',tomakeaDBquery.
-57-Slide48/64December6,2002ErrorDocumentApache'sErrorDocumentdirectivecancomeinhandy.
Forexample,thislineinyourApacheconfigurationfile:ErrorDocument404/error.
phpCanbeusedtoredirectall404errorstoaPHPscript.
Thefollowingservervariablesareofinterest:o$REDIRECT_ERROR_NOTES-Filedoesnotexist:/docroot/boguso$REDIRECT_REQUEST_METHOD-GETo$REDIRECT_STATUS-404o$REDIRECT_URL-/docroot/bogusDon'tforgettosenda404statusifyouchoosenottoredirecttoarealpage.
InterestingusesoSearchforclosestmatchingvalidURLandredirectoUseattemptedurltextasaDBkeywordlookupoFunkycaching-58-Slide49/64December6,2002FunkyCachingAninterestingwaytohandlecachingistohaveall404'sredirectedtoaPHPscript.
ErrorDocument404/generate.
phpTheninyourgenerate.
phpscriptusethecontentsof$REDIRECT_URItodeterminewhichURLthepersonwastryingtogetto.
InyourdatabaseyouwouldthenhavefieldslinkingcontenttotheURLtheyaffectandfromthatyoushouldbeabletogeneratethepage.
Theninyourgenerate.
phpscriptdosomethinglike:So,thewayitworks,whenarequestcomesinforapagethatdoesn'texist,generate.
phpchecksthedatabaseanddeterminesifitshouldactuallyexistandifsoitwillcreateitandrespondwiththisgenerateddata.
ThenextrequestforthatsameURLwillgetthegeneratedpagedirectly.
Soinordertorefreshyourcacheyousimplyhavetodeletethefiles.
-59-Slide50/64December6,2002VariablevariablesAvariablevariablelookslikethis:$$varSo,if$var='foo'and$foo='bar'then$$varwouldcontainthevalue'bar'because$$varcanbethoughtofas$'foo'whichissimply$foowhichhasthevalue'bar'.
Variablevariablessoundlikeacrypticauselessconcept,buttheycanbeusefulsometimes.
Forexample,ifwehaveaconfigurationfileconsistingofconfigurationdirectivesandvaluesinthisformat:foo=barabc=123Thenitisveryeasytoreadthisfileandcreatecorrespondingvariables:Alongthesamelinesasvariablevariables,youcancreatecompoundvariablesandvariablefunctions.
-60-Slide51/64December6,2002OptimizationDon'tusearegexifyoudon'thavetoPHPhasarichsetofstringmanipulationfunctions-usethem!
BAD:GOOD:BAD:GOOD:pearinstallapddownloadingapd-0.
4p1.
tgz.
.
.
.
.
.
done:39,605bytes16sourcefiles,buildingrunning:phpizePHPApiVersion:20020918ZendModuleApiNo:20020429ZendExtensionApiNo:20021010buildingin/var/tmp/pear-build-root/apd-0.
4p1running:/tmp/tmprFlAqf/apd-0.
4p1/configurerunning:makeapd.
socopiedto/tmp/tmprFlAqf/apd-0.
4p1/apd.
soinstallok:apd0.
4p1Woohoo!
www:~>pearinfoapdAboutapd-0.
4p1|Package|apd||Summary|Afull-featuredengine-levelprofiler/debugger||Description|APDisafull-featuredprofiler/debuggerthatis|||loadedasazend_extension.
Itaimstobean|||analogofC'sgproforPerl'sDevel::DProf.
||Maintainers|GeorgeSchlossnagle(lead)||Version|0.
4p1||ReleaseDate|2002-11-25||ReleaseLicense|PHPLicense||ReleaseState|stable||ReleaseNotes|Fixforpre-4.
3versionsofphp||LastModified|2002-12-02|www:~>pearconfig-showConfiguration:|PEARexecutables|bin_dir|/usr/local/bin||directory||||PEARdocumentation|doc_dir|/usr/local/lib/php/docs||directory|||||ffff11|PHPextension|||ffff11|ext_dir|||ffff11|/usr/local/lib/php/extensions/no-de||||ffff11|directory||||ffff11|bug-non-zts-20020429|||PEARdirectory|php_dir|/usr/local/lib/php||PEARInstallercache|cache_dir|/tmp/pear/cache||directory||||PEARdatadirectory|data_dir|/usr/local/lib/php/data||PEARtestdirectory|test_dir|/usr/local/lib/php/tests||CacheTimeToLive|cache_ttl|||PreferredPackage|preferred_state|stable|-65-|State||||Unixfilemask|umask|18||DebugLogLevel|verbose|1||HTTPProxyServer|http_proxy|||Address||||PEARserver|master_server|pear.
php.
net||PEARpassword(for|password|||maintainers)||||PEARusername(for|username|||maintainers)|||-66-Slide55/64December6,2002ProfilingPHPwww:~>cd/usr/local/lib/phpwww:/usr/local/lib/php>ln-sextensions/no-debug-non-zts-20020429/apd.
soapd.
soTheninyourphp.
inifile:zend_extension="/usr/local/lib/php/apd.
so"apd.
dumpdir=/tmpItisn'tcompletelytransparent.
Youneedtotelltheprofilerwhentostartprofiling.
Atthetopofascriptyouwanttoprofile,addthiscall:Theusethecommand-linetoolcalledpprofp:wwww:~>pprofppprofpSortoptions-aSortbyalphabeticnamesofsubroutines.
-lSortbynumberofcallstosubroutines-mSortbymemoryusedinafunctioncall.
-rSortbyrealtimespentinsubroutines.
-RSortbyrealtimespentinsubroutines(inclusiveofchildcalls).
-sSortbysystemtimespentinsubroutines.
-SSortbysystemtimespentinsubroutines(inclusiveofchildcalls).
-uSortbyusertimespentinsubroutines.
-USortbyusertimespentinsubroutines(inclusiveofchildcalls).
-vSortbyaverageamountoftimespentinsubroutines.
-zSortbyuser+systemtimespentinsubroutines.
(default)Displayoptions-cDisplayRealtimeelapsedalongsidecalltree.
-iSuppressreportingforphpbuiltinfunctions-OSpecifiesmaximumnumberofsubroutinestodisplay.
(default15)-tDisplaycompressedcalltree.
-TDisplayuncompressedcalltree.
www:~>ls-latr/tmp/pprofp.
*-rw-r--r--1nobodynobody16692Dec301:19/tmp/pprof.
04545www:~>pprofp-z/tmp/pprof.
04545Tracefor/home/rasmus/phpweb/index.
phpTotalElapsedTime=0.
69TotalSystemTime=0.
01TotalUserTime=0.
08RealUserSystemsecs/cumm%Time(excl/cumm)(excl/cumm)(excl/cumm)Callscalls/callMemoryUsageName33.
30.
110.
130.
020.
030.
010.
0170.
00430.
0057298336require_once22.
20.
020.
020.
020.
020.
000.
001830.
00010.
0001-33944feof11.
10.
010.
010.
010.
010.
000.
0030.
00330.
0033-14808define11.
10.
040.
040.
010.
010.
000.
001820.
00010.
0001112040fgetcsv-67-11.
10.
250.
250.
010.
010.
000.
0060.
00170.
00173768getimagesize11.
10.
010.
010.
010.
010.
000.
00550.
00020.
00022568sprintf0.
00.
000.
000.
000.
000.
000.
0070.
00000.
0000-136printf0.
00.
000.
000.
000.
000.
000.
0010.
00000.
0000136htmlspecialchars0.
00.
000.
000.
000.
000.
000.
0010.
00000.
0000-16mirror_provider_url0.
00.
000.
000.
000.
000.
000.
0070.
00000.
0000112spacer0.
00.
000.
000.
000.
000.
000.
00100.
00000.
0000-552delim0.
00.
000.
000.
000.
000.
000.
0010.
00000.
0000112mirror_provider0.
00.
000.
000.
000.
000.
000.
00200.
00000.
0000-624print_link0.
00.
000.
000.
000.
000.
000.
0010.
00000.
000024have_stats0.
00.
000.
000.
000.
000.
000.
0010.
00000.
0000-72make_submit0.
00.
000.
000.
000.
000.
000.
0020.
00000.
0000112strrchr0.
00.
080.
080.
000.
000.
000.
0020.
00000.
0000168filesize0.
00.
000.
000.
000.
000.
000.
0010.
00000.
0000-16commonfooter0.
00.
000.
110.
000.
000.
000.
0020.
00000.
00000download_link0.
00.
000.
250.
000.
010.
000.
0060.
00000.
0017208make_image-68-Slide56/64December6,2002debug_backtracedebug_backtrace()isanewfunctioninPHP4.
3Customerrorhandler\n";echo"Backtrace\n";$trace=debug_backtrace();foreach($traceas$ent){if(isset($ent['file']))$ent['file'].
':';if(isset($ent['function'])){echo$ent['function'].
'(';if(isset($ent['args'])){$args='';foreach($ent['args']as$arg){$args.
=$arg.
',';}echortrim(short($args),',');}echo')';}if(isset($ent['line']))echo'atline'.
$ent['line'].
'';if(isset($ent['file']))echo'in'.
short($ent['file']);echo"\n";}}set_error_handler('myErrorHandler');include'file2.
php';test2(1,0);>Customerrorhandler-69-Slide57/64December6,2002SquidForreallybusysites,areverseproxylikeSquidismagical!
Eitherrunitasasingle-serveraccelerator:Orasafront-endcachetoanumberoflocalorremoteservers:Note:Watchoutforanyuseof$REMOTE_ADDRinyourPHPscripts.
Use$HTTP_X_FORWARDED_FORinstead.
-70-Slide58/64December6,2002SquidConfigurationMakeitlistentoport80onourexternalinterface:http_port198.
186.
203.
51:80Ifwedon'tdocgi-binstuff,commenttheseout:#aclQUERYurlpath_regexcgi-bin#no_cachedenyQUERYIfwehaveplentyofRAM,bumpthisupabit:cache_mem16MBmaximum_object_size14096KBSpecifywheretostorecachedfiles(sizeinMegs,level1subdirs,level2subdirs)cache_dirufs/local/squid/cache50016256Getridofthebigstore.
logfile:cache_store_lognoneSetourSNMPpubliccommunitystring:aclsnmppublicsnmp_communitypublicGetridof"allowall"anduselistofhostsweareblocking(1ipperline):#http_accessallowallaclforbiddensrc"/local/squid/etc/forbidden"http_accessallow!
forbiddenSetuser/groupsquidshouldrunas:cache_effective_usersquidcache_effective_groupdaemonSingle-serverreverseproxysetup(setupApachetolistentoport80ontheloopback):httpd_accel_host127.
0.
0.
1httpd_accel_port80httpd_accel_single_hostonhttpd_accel_uses_host_headeronOnlyallowlocalhostaccessthroughsnmp:snmp_accessallowsnmppubliclocalhost-71-Slide59/64December6,2002MySQLReplicationAsofversion3.
23.
15(trytouse3.
23.
29orlater),MySQLsupportsone-wayreplication.
Sincemostwebapplicationsusuallyhavemorereadsthanwrites,anarchitecturewhichdistributesreadsacrossmultipleserverscanbeverybeneficial.
IntypicalMySQLfashion,settingupreplicationistrivial.
Onyourmasterserveraddthistoyour"my.
cnf"file:[mysqld]log-binserver-id=1Andaddareplicationuseridforslavestologinas:GRANTFILEON*.
*TOrepl@"%"IDENTIFIEDBY'foobar';IfyouareusingMySQL4.
0.
2orlater,replaceFILEwithREPLICATIONSLAVEintheabove.
Thenonyourslaveservers:[mysqld]set-variable=max_connections=200log-binmaster-host=192.
168.
0.
1master-user=replmaster-password=foobarmaster-port=3306server-id=2Makesureeachslavehasitsownuniqueserver-id.
Andsincethesewillberead-onlyslaves,youcanstartthemwiththeseoptionstospeedthemupabit:--skip-bdb--low-priority-updates--delay-key-write-for-all-tablesStopyourmasterserver.
Copythetablefilestoeachofyourslaveservers.
Restartthemaster,thenstartalltheslaves.
Andyouaredone.
CombiningMySQLreplicationwithaSquidreversecacheandredirectorandyoumighthaveanarchitecturelikethis:-72-Youwouldthenwriteyourapplicationtosendalldatabasewritestothemasterserverandallreadstothelocalslave.
Itisalsopossibletosetuptwo-wayreplication,butyouwouldneedtosupplyyourownapplication-levellogictomaintainatomicityofdistributedwrites.
Andyoulosealotoftheadvantagesofthisarchitectureifyoudothisasthewriteswouldhavetogotoalltheslavesanyway.
-73-Slide60/64December6,2002LoadBalancingTheEasy(AndExpensive)SolutionYoucanbuydedicatedboxesthatdoallsortsofadvancedloadbalancingforyou.
Somepopularonesare:oCiscoCSSoFoundryServerIronoIntelNetstructureoF5BIG-IPIfyouareonLinuxyoucouldalsotryLVS.
Seewww.
LinuxVirtualServer.
org.
-74-Slide61/64December6,2002LoadBalancingwithSquidTherearetwoprimarywaystoconfigureSquidtobealoadbalancer.
Private/etc/hostsTheeasiestistosimplylistmultipleipsforthehttpd_accel_hostinyour/etc/hostsfileandSquidwillautomaticallyround-robinacrossthebackendservers.
Usecache_peerThisismorecomplex.
Squidhasadvancedsupportforcommunicatingwithothercaches.
ItjustsohappensthatthiscommunicationhappensoverHTTPsoyoucansetSquiduptotreatthewebserversyouwishtoloadbalanceaspeercaches.
Theconfigurationwouldlooksomethinglikethis:httpd_accel_hostwww.
visible-domain.
comhttpd_accel_uses_host_headeronnever_directallowallcache_peerserver1parent800no-queryround-robincache_peerserver2parent800no-queryround-robincache_peerserver3parent800no-queryround-robinno-queryintheabovetellsSquidnottotrytosendICP(InternetCacheProtocol)requeststotheApacheservers.
YoucouldturnontheechoportoneachserverandredirecttheseICPrequeststotherewhichwouldmakethissystemautomaticallydetectaserverthatisdown.
AvoidingRedirectorsItisgenerallyagoodideatoavoidexternalredirectors.
AlotofthingscanbedonedirectlyinSquid'sconfigfile.
Forexample:acldomain1dstdomainwww.
domain1.
comacldomain2dstdomainwww.
domain2.
comacldomain3dstdomainwww.
domain3.
comcache_peer_accessserver1allowdomain1cache_peer_accessserver2allowdomain2cache_peer_accessserver3allowdomain3cache_peer_accessserver1denyallcache_peer_accessserver2denyallcache_peer_accessserver3denyallThiswouldconfigureSquidtosendrequestsforpagesoncertaindomainstocertainbackendservers.
ThesebackendserverscouldactuallybealiasestodifferentipsonthesameserverifyouwantedtorunmultipleApacheinstancesondifferentportsonthesamebox.
-75-Slide62/64December6,2002LatestDevelopmentsoPEARandPECLoSOAPoZendEngine2oNewObjectmodeloUnifiedConstructorsandDestructorsoObjectsarereferencesoExceptionsoUser-spaceoverloadingoSRM-76-Slide63/64December6,2002FutureoApache2.
0oExtensionstotalktoeverything!
ophp-soapoParrot-77-Slide64/64December6,2002ResourcesHomePage:http://www.
php.
netManual:http://php.
net/manualTutorial:http://php.
net/tut.
phpBooks:http://php.
net/books.
php-78-IndexAgenda2Setup3SanityCheck4ConnectingtoMySQL5PersistentConnections6CreatingaDatabase7InsertingData8SelectingData9Dealingwithtimestamps10ChangingExistingRows11MagicQuotes12ASimpleGuestbook13DB-drivenGuestbook14DB-drivenGuestbook15DBAbstraction16HTTPHeaders17Cookies18CookieExpiry19GD1/220Colours21Colours22TruecolorColors23TruecolorColors25ImageColorAt26GD1/227Text28TTFText29EXIF31PDFson-the-fly33Ming-Flash35MoreMing36Cool!
38Sessions40SessionConfiguration41CustomBackend42CustomBackend43register_globals45SafeMode48Security49Security50Security51Security52Security53References54ReturningReferences55Addinganextension56$PATH_INFO57ErrorDocument58FunkyCaching59Variablevariables60Optimization61PHPOpcodeCaches62PHPOpcodeCaches64ProfilingPHP65ProfilingPHP67debug_backtrace69Squid70SquidConfiguration71MySQLReplication72LoadBalancing74LoadBalancingwithSquid75LatestDevelopments76Future77Resources78
pacificrack怎么样?pacificrack商家发布了七月最新优惠VPS云服务器计划方案,推出新款优惠便宜VPS云服务器采用的是国产魔方管理系统,也就是PR-M系列,全系基于KVM虚拟架构,这次支持Windows server 2003、2008R2、2012R2、2016、2019、Windows 7、Windows 10以及Linux等操作系统,最低配置为1核心2G内存1Gbps带宽1...
一、麻花云官网点击直达麻花云官方网站二、活动方案优惠码:专属优惠码:F1B07B 享受85折优惠。点击访问活动链接最新活动 :五一狂欢 惠战到底 香港云主机 1.9折起香港特价体验云主机CN2 云服务器最新上线KVM架构,,默认40G SSD,+10G自带一个IPv4,免费10Gbps防御,CPU内存带宽价格购买1核1G1M19元首月链接2核2G 2M92元/3个月链接2核4G3M112元/3个月...
青云互联怎么样?青云互联是一家成立于2020年6月份的主机服务商,致力于为用户提供高性价比稳定快速的主机托管服务,目前提供有美国免费主机、香港主机、香港服务器、美国云服务器,让您的网站高速、稳定运行。目前,美国洛杉矶cn2弹性云限时七折,美国cera机房三网CN2gia回程 13.3元/月起,可选Windows/可自定义配置。点击进入:青云互联官网青云互联优惠码:七折优惠码:dVRKp2tP (续...
extension_dir为你推荐
云爆发养兵千日用兵千日这个说法对不对云计算什么是云计算?冯媛甑冯媛甄详细资料月神谭求古典武侠类的变身小说~!钟神发跪求钟神发名言出处,A站大神看过来百度关键词分析百度竞价关键词分析需要从哪些数据入手?789se.comhttp://gv789.com/index.php这个网站可信吗?是真的还是假的!haole10.com空人电影网改网址了?www.10yyy.cn是空人电影网么javbibi日文里的bibi是什么意思dadi.tv海信电视机上出现英文tvservice是什么意思?
个人域名备案 火山主机 主机测评网 enzu 便宜服务器 pw域名 天猫双十一抢红包 lamp配置 丹弗 jsp空间 免费测手机号 福建铁通 电信主机 太原联通测速 linode支付宝 中国电信网络测速 日本代理ip 中国域名 免费网络 iki 更多