Future Deployment of PHP Applications

Document Sample
Future Deployment of PHP Applications Powered By Docstoc
					Future Deployment of PHP Applications Davey Shafik
davey@php.net

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!
Orlando, Florida April 25-28, 2006 2

This Session

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

Orlando, Florida April 25-28, 2006

3

Questions?

Feel free to interrupt me!

Orlando, Florida April 25-28, 2006

4

PEAR Channels

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.
Orlando, Florida April 25-28, 2006 6

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.
Orlando, Florida April 25-28, 2006 7

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_Frontend
Orlando, Florida April 25-28, 2006 8

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
Orlando, Florida April 25-28, 2006 9

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?
Orlando, Florida April 25-28, 2006 10

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

Orlando, Florida April 25-28, 2006

11

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/Chiara_PEAR_Server0.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_Server#featurename"
chiara/Chiara_PEAR_Server has post-install scripts: /usr/share/pear/Chiara/PEAR/Server/mysqlinstall.php Use "pear run-scripts chiara/Chiara_PEAR_Server" to run DO NOT RUN SCRIPTS FROM UNTRUSTED SOURCES

Orlando, Florida April 25-28, 2006

12

Crtx_PEAR_Channel_Frontend
Created By: • Davey Shafik
– Starting to see a pattern here?

Improved and Maintained by: • Greg Beaver
– Yeah, him again.

Orlando, Florida April 25-28, 2006

19

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.

Orlando, Florida April 25-28, 2006

20

Features
Features: • Package Page
– Links to Bugs, Dependencies, etc.

• Package List • Package Search • Maintainer List • Contact Form • RSS Feeds • etc...
Orlando, Florida April 25-28, 2006 21

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?

Orlando, Florida April 25-28, 2006

22

Installation

$ pear install crtx/Crtx_PEAR_Channel_Frontend-alpha downloading Crtx_PEAR_Channel_Frontend-0.3.1.tgz ... Starting to download Crtx_PEAR_Channel_Frontend0.3.1.tgz (23,142 bytes) ........done: 23,142 bytes install ok: channel://pear.crtx.org/Crtx_PEAR_Channel_Frontend0.3.1

Orlando, Florida April 25-28, 2006

23

Final Tasks
• Move files • Customize CSS • Create packages, maintainers and categories.
Starting with:
$ mv /usr/share/pear/docs/Crtx_PEAR_Channel_Frontend/docs /examples/* /var/www/pear/

Don't forget to use your own directory structures!
Orlando, Florida April 25-28, 2006 24

• Note: Switch to Editor Here

Orlando, Florida April 25-28, 2006

25

PEAR Packages 101
Packaging PEAR compatible packages is simple. • Create your Package • Create a PEAR_PackageFileManager script • Run the script • Install to test • Upload
Orlando, Florida April 25-28, 2006 26

Our Package

/Test.php
/Test

/docs

/Subclass.php /README /basic.phpt

/tests

Orlando, Florida April 25-28, 2006

27

Creating the Package

1) Create a Packaging Script 2) Run it 3) Run the PEAR package command

Orlando, Florida April 25-28, 2006

28

The End?

PHP_Archive & PHAR

PHP_Archive
• Created By
– Davey Shafik

• Improved and Maintained By
– Greg Beaver – Marcus Böerger

Orlando, Florida April 25-28, 2006

32

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.
Orlando, Florida April 25-28, 2006 33

PHAR Then...

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

Orlando, Florida April 25-28, 2006

34

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

Orlando, Florida April 25-28, 2006

35

Stability
• PHARs are stable • Backwards incompatibility is impossible

• PHARs are great for non-web apps
• We're working on web apps…

Orlando, Florida April 25-28, 2006

36

The End
• Questions? • Comments? • Gripes? • E-Mail me, davey@php.net

Orlando, Florida April 25-28, 2006


				
DOCUMENT INFO
Shared By:
Categories:
Stats:
views:113
posted:7/9/2009
language:English
pages:30
Description: Future Deployment of PHP Applications