Future Deployment of PHP Applications - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

Future Deployment of PHP Applications

Description:

Future Deployment of PHP Applications – PowerPoint PPT presentation

Number of Views:77
Avg rating:3.0/5.0
Slides: 31
Provided by: clues
Category:

less

Transcript and Presenter's Notes

Title: Future Deployment of PHP Applications


1
Future Deployment of PHP Applications
Davey Shafik
davey_at_php.net
2
About Me
  • Davey Shafik is
  • A long time contributor to PEAR
  • http//pear.php.net
  • A long time blogger
  • http//pixelated-dreams.com
  • A long time helper
  • irc.freenode.net PHP php.thinktank
  • Contributor to the Zend PHP Framework
  • http//framework.zend.com
  • Hard of hearing, so speak up!

3
This Session
  • We will be covering
  • What are PEAR Channels?
  • An in-depth look into PEAR Channels
  • What is PHP_Archive? What is PHAR?

4
Questions?
Feel free to interrupt me!
5
PEAR Channels
6
PEAR Channels
  • Robust and Effective way of distributing
    applications.
  • Allow complex Dependencies. Even across channels.
  • Standardized by the PEAR Project
  • Easy for users.
  • Uses the PEAR command-line tool. Installed by
    default with PHP.

7
PEAR Packages
  • PEAR Packages are a standardized distribution
    method for PHP code and PHP extensions.
  • Cross Platform
  • Optionally Gzip compressed Tar archives
  • Common directory structure (recommended)
  • Easily installed, removed and maintained
  • Allows for post-install tasks to be run (e.g.
    Database setup.)
  • Allow for non-PHP content.

8
The Basics
  • Channels use REST Web Services
  • Smaller messages than XML-RPC
  • Quicker to generate/parse
  • Channels are defined using a simple XML file in
    the document root
  • You can easily write your own Channel
    Server/Frontend
  • OR
  • Use Chiara_PEAR_Server Crtx_PEAR_Channel_Fronten
    d

9
Setting up a PEAR Channel
  • Setting up a PEAR Channel in 4 easy steps
  • 1) Install Chiara_PEAR_Server
  • 2) Run the Post Install Script
  • Creates channel.xml
  • Sets up your Database
  • Sets up your Document Root
  • 3) Install Crtx_PEAR_Channel_Frontend
  • Copy files to your Document Root
  • 4) Upload Packages

10
Chiara_PEAR_Server
  • Created By
  • Greg Beaver
  • Creator of PEAR Channels
  • Improved and Maintained By
  • Clay Loveless
  • Creator and Maintainer of pearified.com A
    repository of PEARified applications
  • Davey Shafik
  • thats me, remember?

11
Installing Chiara_PEAR_Server
  • ... AKA using PEAR Channels for the first time.
  • Discovering the Channel
  • pear channel-discover pear.chiaraquartet.net
  • Adding Channel "pear.chiaraquartet.net" succeeded
  • Discovery of channel "pear.chiaraquartet.net"
    succeeded

12
Install Chiara_PEAR_Server
  • pear install --alldeps chiara/Chiara_PEAR_Server
    -alpha
  • downloading Chiara_PEAR_Server-0.18.4.tgz ...
  • Starting to download Chiara_PEAR_Server-0.18.4.tgz
    (32,479 bytes)
  • .........done 32,479 bytes
  • .....
  • install ok channel//pear.chiaraquartet.net/Chiar
    a_PEAR_Server-0.18.4
  • Chiara_PEAR_Server Optional feature pearweb
    available (Public frontend for users to browse
    channel packages)
  • To install use "pear install chiara/Chiara_PEAR_Se
    rverfeaturename"
  • chiara/Chiara_PEAR_Server has post-install
    scripts
  • /usr/share/pear/Chiara/PEAR/Server/mysqlinstall.ph
    p
  • Use "pear run-scripts chiara/Chiara_PEAR_Server"
    to run
  • DO NOT RUN SCRIPTS FROM UNTRUSTED SOURCES

13
Installtion Cont...
  • Run the scripts
  • pear run-scripts chiara/Chiara_PEAR_Server
  • Including external post-installation script
    "/usr/share/pear/Chiara/PEAR/Server/mysqlinstall.p
    hp" - any errors are in this script
  • Inclusion succeeded
  • running post-install script "Server_mysqlinstall_p
    ostinstall-gtinit()"
  • init succeeded
  • Create/Upgrade database for Chiara_PEAR_Server?
    All previous installations must run the script
    yes
  • Your choices
  • Create/Upgrade database for Chiara_PEAR_Server?
    All previous installations must run the script
    yes
  • These Choices OK? (use "abort" to halt) yes

14
  • Mysql database pear
  • Mysql Username (must have create permision)
    pear
  • Mysql password pear
  • Database Host localhost
  • Channel Administrator Handle (package.xml user
    tag) davey
  • Channel Name (server uri like pear.php.net)
    pear.example.org
  • Your choices
  • Mysql database pear
  • Mysql Username (must have create permision) pear
  • Mysql password pear
  • Database Host localhost
  • Channel Administrator Handle (package.xml user
    tag) davey
  • Channel Name (server uri like pear.php.net)
    pear.example.org
  • These Choices OK? (use "abort" to halt) yes

15
  • Copying DB_DataObject config file to
    "/usr/share/pear/data/Chiara_PEAR_Server/data/DBDa
    taObject/pear.ini"
  • Creating Chiara_PEAR_Server database structure...
  • Updating database succeeded
  • Suggested Channel Alias pear example
  • Channel summary phptek Example Channel
  • Your choices
  • Suggested Channel Alias example
  • Channel summary phptek Example Channel
  • These Choices OK? (use "abort" to halt) yes
  • Channel Administrator Real Name Davey Shafik
  • Channel Administrator Email davey_at_php.net
  • Channel Administrator Password example

16
  • Your choices
  • Channel Administrator Real Name Davey Shafik
  • Channel Administrator Email davey_at_php.net
  • Channel Administrator Password example
  • These Choices OK? (use "abort" to halt) yes
  • Add the primary administrator
  • Creation of admin user succeeded
  • PEAR Configuration File Location
    /home/davey/.pearrc
  • Path to document root of web server for
    pear.example.org /var/www/pear
  • name of frontend.php HTML admin frontend file
    pearmin.php
  • temporary path to save uploaded releases in
    /tmp
  • port clients should connect to (443 is SSL, 80 is
    regular HTTP) 80
  • protocol clients should use to connect

17
  • (http or https) http
  • Your choices
  • PEAR Configuration File Location
    /home/davey/.pearrc
  • Path to document root of web server for
    pear.example.org /var/www/pear
  • name of frontend.php HTML admin
  • frontend file pearmin.php
  • temporary path to save uploaded releases in /tmp
  • port clients should connect to (443 is SSL, 80 is
    regular HTTP) 80
  • protocol clients should use to connect (http or
    https) http
  • These Choices OK? (use "abort" to halt) yes
  • adding channel to local registry
  • Successfully created /var/www/pear/pearmin.php
  • Successfully created /var/www/pear/pear_server.css

18
  • Enabling REST for channel pear.example.org
  • Adding REST 1.0 and REST 1.1 to channel.xml
  • Saving Categories REST
  • Category Default
  • Saving All Maintainers REST
  • Saving Maintainer REST
  • Maintainer davey
  • Saving Package REST
  • Saving Category Package REST
  • Default
  • Install scripts complete

19
Crtx_PEAR_Channel_Frontend
  • Created By
  • Davey Shafik
  • Starting to see a pattern here?
  • Improved and Maintained by
  • Greg Beaver
  • Yeah, him again.

20
Need To Know
  • Plays nice with Chiara_PEAR_Server
  • Actually, it doesn't work with out it
  • CSS Styleable
  • OR
  • Do it from scratch
  • Just works.

21
Features
  • Features
  • Package Page
  • Links to Bugs, Dependencies, etc.
  • Package List
  • Package Search
  • Maintainer List
  • Contact Form
  • RSS Feeds
  • etc...

22
Installation
  • Discovering the Channel
  • pear channel-discover pear.crtx.org
  • Adding Channel "pear.crtx.org" succeeded
  • Discovery of channel "pear.crtx.org" succeeded
  • Starting to look familiar?

23
Installation
  • pear install crtx/Crtx_PEAR_Channel_Frontend-alp
    ha
  • downloading Crtx_PEAR_Channel_Frontend-0.3.1.tgz
    ...
  • Starting to download Crtx_PEAR_Channel_Frontend-0.
    3.1.tgz (23,142 bytes)
  • ........done 23,142 bytes
  • install ok channel//pear.crtx.org/Crtx_PEAR_Chan
    nel_Frontend-0.3.1

24
Final Tasks
  • Move files
  • Customize CSS
  • Create packages, maintainers and categories.
  • Starting with
  • mv /usr/share/pear/docs/Crtx_PEAR_Channel_Fronte
    nd/docs/examples/ /var/www/pear/
  • Don't forget to use your own directory structures!

25
  • Note Switch to Editor Here

26
PEAR Packages 101
  • Packaging PEAR compatible packages is simple.
  • Create your Package
  • Create a PEAR_PackageFileManager script
  • Run the script
  • Install to test
  • Upload

27
Our Package
  • /Test.php
  • /Test
  • /Subclass.php
  • /docs
  • /README
  • /tests
  • /basic.phpt

28
Creating the Package
  • Create a Packaging Script
  • Run it
  • Run the PEAR package command

29
  • Go back to browser and upload package showing off
    the admin and frontend
  • Finish talk if no more time, otherwise, move on!

30
The End?
31
PHP_Archive PHAR
32
PHP_Archive
  • Created By
  • Davey Shafik
  • Improved and Maintained By
  • Greg Beaver
  • Marcus Böerger

33
PHP Archives - PHARs
  • PHP Archives (PHARs) are optionally compressed
    files containing entire PHP applications.
  • This includes
  • PHP Code
  • HTML Files
  • Images
  • CSS
  • JS
  • Anything
  • One notable exception SQLite Databases.

34
PHAR Then...
  • Originally PHAR files were
  • Non-compressed
  • Specially formatted, valid TAR archives
  • Created and read using PHP code

35
PHAR Now...
  • Today, PHAR files are
  • Optionally Compressed
  • Custom, optimized archive format
  • Can be created/read using PHP
  • Or
  • Can be read using ext/phar
  • Proposed for bundling in PHP 5.2.0/6.0

36
Stability
  • PHARs are stable
  • Backwards incompatibility is impossible
  • PHARs are great for non-web apps
  • We're working on web apps

37
The End
  • Questions?
  • Comments?
  • Gripes?
  • E-Mail me, davey_at_php.net
Write a Comment
User Comments (0)
About PowerShow.com