1. New York PHP - Introduction to AMP Technology
Download
Presentation
Introduction to AMP Technology
Technical Overview
NYPHP Internal Presentation
September 25, 2002
Presented by Hans Zaunere, Daniel Kushner and Bill Patterson
http://www.nyphp.org http://apache.org http://mysql.com http://php.net 9/25/02
http://www.nyphp.org/content/presentations/ampintro2/[9/12/2009 5:53:09 PM]
2. New York PHP - AMP Technology - Technical Overview - Slide 1 of 10
1 2 3 4 5 6 7 8 9 10
AMP Setup and Implementation?
Installing and configuring each component
Apache with Dynamic Shared Object (DSO)
Support
Standard MySQL
PHP 4 as a DSO with native MySQL support
Testing the install with phpMyAdmin
Using AMP
Setting php.ini values at runtime
Array manipulation
Database connections and queries
Error checking and reporting
http://www.nyphp.orghttp://apache.orghttp://mysql.comhttp://php.net9/25/02
http://www.nyphp.org/content/presentations/ampintro2/001.php?body=48[9/12/2009 5:53:17 PM]
3. New York PHP - AMP Technology - Technical Overview - Slide 2 of 10
1 2 3 4 5 6 7 8 9 10
Apache 1.3.26
--prefix=/demo/apache
Apahe's tree top
--enable-module=so
Enable DSO support (mod_php)
--with-port=8000
--server-uid[gid]=praxis
Only Apache children will run as this user/group
http://www.nyphp.orghttp://apache.orghttp://mysql.comhttp://php.net9/25/02
http://www.nyphp.org/content/presentations/ampintro2/002.php?body=48[9/12/2009 5:53:21 PM]
4. New York PHP - AMP Technology - Technical Overview - Slide 3 of 10
1 2 3 4 5 6 7 8 9 10
MySQL 3.23.52
Configuration and Compilation
--prefix=/demo/mysql
MySQL's tree top
--with-unix-socket-
path=/demo/tmp/mysql.sock
Needed with multiple MySQL instances per box
--with-mysqld-user=praxis
MySQL will completely drop root and run as this
user
MySQL offers many other configuration
options:
DB handlers (InnoDB) provide transactions etc.
Compilation tweaks for improved performance
MySQL AB binaries are recommended for
production systems (notably on Linux)
http://www.nyphp.orghttp://apache.orghttp://mysql.comhttp://php.net9/25/02
http://www.nyphp.org/content/presentations/ampintro2/003.php?body=48[9/12/2009 5:53:24 PM]
5. New York PHP - AMP Technology - Technical Overview - Slide 4 of 10
1 2 3 4 5 6 7 8 9 10
MySQL 3.23.52
Configuration and Compilation
/demo/mysql/bin/mysql_install_db
Prepare and install the 'mysql' database
User and permission data dictionary used internally by
MySQL
/demo/mysql/bin/safe_mysqld &
Start mysqld wrapped in a monitoring script
/demo/mysql/bin/mysqladmin -u root –p
'demo'
Set root (superuser) password for MySQL
Has no bearing on operating system accounts
http://www.nyphp.orghttp://apache.orghttp://mysql.comhttp://php.net9/25/02
http://www.nyphp.org/content/presentations/ampintro2/004.php?body=48[9/12/2009 5:53:27 PM]
6. New York PHP - AMP Technology - Technical Overview - Slide 5 of 10
1 2 3 4 5 6 7 8 9 10
PHP 4.2.3
Configuration and Compilation
--prefix=/demo/php
PHP's tree top
--with-apxs=/demo/apache/bin/apxs
Compile PHP as an Apache DSO
--with-mysql=/demo/mysql
Point to MySQL's native client libraries
http://www.nyphp.orghttp://apache.orghttp://mysql.comhttp://php.net9/25/02
http://www.nyphp.org/content/presentations/ampintro2/005.php?body=48[9/12/2009 5:53:30 PM]
7. New York PHP - AMP Technology - Technical Overview - Slide 6 of 10
1 2 3 4 5 6 7 8 9 10
PHP 4.2.3
Setup and Integration
cp php.ini-recommended
/demo/php/lib/php.ini
Always use php.ini-recommended
Maintainable configuration for future PHP versions
Ensure proper httpd.conf directives:
LoadModule php4_module libexec/libphp4.so
Load PHP DSO
AddType application/x-httpd-php .php
Pass .php files to PHP
AddType application/x-httpd-php-source .phps
Pass .phps (source) files to PHP for syntax highlighting
http://www.nyphp.orghttp://apache.orghttp://mysql.comhttp://php.net9/25/02
http://www.nyphp.org/content/presentations/ampintro2/006.php?body=48[9/12/2009 5:53:32 PM]
8. New York PHP - AMP Technology - Technical Overview - Slide 7 of 10
1 2 3 4 5 6 7 8 9 10
Getting AMP Online
The data layer (MySQL) is already started
Fire up the interface layer:
/demo/apache/bin/apachectl start
http://demo.nyphp.org:8000/sql/
phpMyAdmin is a good test to ensure everything is
properly loaded and configured
http://www.nyphp.orghttp://apache.orghttp://mysql.comhttp://php.net9/25/02
http://www.nyphp.org/content/presentations/ampintro2/007.php?body=48[9/12/2009 5:53:34 PM]
9. New York PHP - AMP Technology - Technical Overview - Slide 8 of 10
1 2 3 4 5 6 7 8 9 10
Putting AMP to Work
initial.phps
http://demo.nyphp.org:8000/code/initial.phps
View source with PHP's built-in
highlighting
GET method checking as a failsafe
Override php.ini setting
Show errors in browser (stdout)
Get MySQL connection online
localhost connections use UNIX domain sockets
Create array of queries
PHP forms a sequential integer-indexed array
http://www.nyphp.orghttp://apache.orghttp://mysql.comhttp://php.net9/25/02
http://www.nyphp.org/content/presentations/ampintro2/008.php?body=48[9/12/2009 5:53:36 PM]
10. New York PHP - AMP Technology - Technical Overview - Slide 9 of 10
1 2 3 4 5 6 7 8 9 10
Putting AMP to Work...
initial.phps
Loop through queries, processing and error
checking
Reconnect to MySQL with the same DB
resource
Different username/password implies new
connection
Old resource is dereferenced and freed by garbage
collector
Create nested arrays for member
information
Automatic sequential integer-indexed array
Each element contains a user-defined associative
array
Loop through members, forming proper
query
INSERT will generate non-zero ID
(auto_increment)
http://www.nyphp.orghttp://apache.orghttp://mysql.comhttp://php.net9/25/02
http://www.nyphp.org/content/presentations/ampintro2/009.php?body=48[9/12/2009 5:53:38 PM]
11. New York PHP - AMP Technology - Technical Overview - Slide 10 of 10
1 2 3 4 5 6 7 8 9 10
Resources
Zend - The PHP Company
PHPBuilder Tutorials, Articles and Code
PHP Triad - AMP Technology Installer for
Windows
AMP Based Professional CMS
phpMyAdmin, phpPgAdmin, Tutorials and
more
DMOZ Open Directory PHP Tutorials
New York PHP Projects and Knowledge
Base
http://www.nyphp.orghttp://apache.orghttp://mysql.comhttp://php.net9/25/02
http://www.nyphp.org/content/presentations/ampintro2/010.php?body=48[9/12/2009 5:53:40 PM]