• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
PHP, Handle with care
 

PHP, Handle with care

on

  • 2,423 views

 

Statistics

Views

Total Views
2,423
Views on SlideShare
1,390
Embed Views
1,033

Actions

Likes
2
Downloads
0
Comments
0

5 Embeds 1,033

http://pbweb.co.uk 1011
http://dex.io 18
http://pbweb.pagodabox.com 2
http://translate.googleusercontent.com 1
https://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    PHP, Handle with care PHP, Handle with care Presentation Transcript

    • PHP, Handle with Care PBWEB.CO.UK @PHILL_BROWN
    • What is a PHP Handler?<?php Interprets Helloecho ‘Hello’; code
    • It began with CGI
    • CGIWeb server PHP
    • Phoning for a taxi
    • CGI• Runs PHP on every request• High CPU• Doesn’t support PHP accelerators eg APC• Has security issues
    • An improvement: mod_suphp
    • Apache changes the PHP process owner
    • mod_suPHP mod_suPHP starts PHP via CGI mod_suPHPApache PHP changes process uid
    • Choosing your driver
    • Site 1cache 757includes 755themes 755Site 2cacheincludesthemes 757 755 755 Without Apache writableSite 3cache 757includes 755themes 755
    • Site 1cache 755includes 755 Running as filethemes 755 ownerSite 2cache 755includes 755themes 755 Apache writableSite 3cache 755includes 755themes 755
    • Site 1cache 775includes 755 Locking down eventhemes 755Site 2cacheincludesthemes 755 755 755 further Apache writableSite 3cache 755includes 755themes 755
    • Create Apache users and site groups Site1Group Site1User Site1Apache
    • drwxrwxr-x Site1User Site1Group cachedrwxr-xr-x Site1User Site1Group includesdrwxr-xr-x Site1User Site1Group theme
    • A different approach: mod_php
    • mod_phpApache Interprets PHP internally
    • Taking your own car
    • mod_php• Preloads PHP environment• Runs as Apache child process = low CPU• Shared memory• Supports bytecaching
    • mod_php• Un-scalable across multiple servers• Can fill up Apache queue = refused requests• Runs as a single user
    • mod_ruid2 - suphp’s better half
    • mod_php + mod_ruid2Apache mod_php mod_ruid2 Change process uid
    • Your own chauffeur
    • FastCGI - nu school
    • FastCGI Runs PHP in aWeb server FCGI server persistent FastCGI process
    • Being at a taxi rank LOADSOF TAXIS
    • FastCGI• Separates PHP from static requests• Uses persistent processes• Highly configurable• Lower CPU but higher memory usage
    • Benefit of separation Client Request static HTML PHPInternal HTTP FCGI server server
    • FastCGI Process Manager: adaptable process spawning
    • Summary CGI suPHP DSO ruid2 fCGI FPMCPU usageSupports PHP AcceleratorsRun as file ownerSeparation of interpreter andserverServer agnosticMemory usage
    • Handling questions.. Intensive processing ProbableQuestion? Phill memory leak ask PBWEB.CO.UK @PHILL_BROWN