300 likes | 421 Views
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
E N D
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
Orlando, Florida April 25-28, 2006 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 Questions? Feel free to interrupt me!
Orlando, Florida April 25-28, 2006 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 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 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 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 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 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 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_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_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 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 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 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 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 Installation $ pear install crtx/Crtx_PEAR_Channel_Frontend-alpha 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_Channel_Frontend-0.3.1
Orlando, Florida April 25-28, 2006 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 Note: Switch to Editor Here
Orlando, Florida April 25-28, 2006 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 Our Package /Test.php /Test /Subclass.php /docs /README /tests /basic.phpt
Orlando, Florida April 25-28, 2006 Creating the Package Create a Packaging Script Run it Run the PEAR package command
Orlando, Florida April 25-28, 2006 PHP_Archive Created By Davey Shafik Improved and Maintained By Greg Beaver Marcus Böerger
PHP Archives - PHARs Orlando, Florida April 25-28, 2006 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 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 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
Stability Orlando, Florida April 25-28, 2006 • PHARs are stable • Backwards incompatibility is impossible • PHARs are great for non-web apps • We're working on web apps…
The End Orlando, Florida April 25-28, 2006 • Questions? • Comments? • Gripes? • E-Mail me, davey@php.net