Acronyms
| CLI | Command Line Interface |
| PEAR | PHP Extension & Application Repository |
| PECL | PHP Extension Community Library i.e. for PHP extensions |
| Phar | PHP Archive … bundles applications into a single file via PHP_Archive |
| .so | shared object |
| TSRM | Thread-safe Resource Manager |
Zend Engine (Zend being a combination of Zeev and Andi). One of the PHP authors is Zeev Suraski; another is Andy Gutmans. Zend refers to the language engine; PHP refers to the complete system. Zend handles macros & functions.
XAMPP PEAR installation
The xampp installation does not require running go-pear.bat. The actual PEAR command calls pear.bat.
Xampp PEAR seems set up for the old PHPcli.exe; so, edit C:\xampp\php\pear.bat … and change:IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=C:\xampp\php\phpcli.exe"to:
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=C:\xampp\php\php.exe"From go-pear.php …
Sorry! The PEAR installer actually does not work on a Windows platform using CGI and Apache.However, Xampp doesn’t place the CLI version in a \cli\ folder; it’s at \xampp\php\php.exe.
Please install the module SAPI
(see http://www.php.net/manual/en/install.apache.php for the instructions)
or use the CLI (cli\php.exe) in the console.
Web PEAR … on Windows and Apache configuration:
Create a C:\xampp\Apache\conf\httpd.conf Alias for /pear/ … C:/Xampp/php/pear/ … and re-start Apache. PHP.exe (i.e. “Everyone”) needs write permission on that \pear\ virtual hosting directory.
In browser, run http://localhost/pear/go-pear.php
PATH requirements
Add C:\xampp\php to the Windows PATH.
PEAR source-code location: Include_path
The PHP.ini include_path directive specifies the PEAR source-code location (C:\xampp\php\pear\). If you have access to the php.ini configuration file for your (shared?) site, you have to add /var/www/www.example.com/includes/ to the directive there. If you do not have access to PHP.ini, you have to set the include_path in each PHP script, calling a PEAR package.
Save yourself some head-scratching by making include_path in both php.ini’s point to the same /pear/data/.
security permissions
David Sklar’s book says PEAR.exe needs to run as “root” i.e. and have write permissions to the directories (C:\xampp\php\pear\) into which it must write.
Go-pear.bat needs write permissions for the User’s (who is running go-pear.bat) temp directory (e.g. C:\documents and settings\userName\Local settings\Temp). However, running go-pear.bat is not required with XAMPP.
Preferred_state
To get the Xampp Pear installation to upgrade less than “stable” packages,
pear config-set preferred_state betaor alpha
Installing & upgrading PEAR packages
I didn’t find a web-interfaced PEAR manager. To install packages,
> pear install –-alldeps packageNameor
> pear install –a packageName
Upgrading PEAR
PEAR won’t upgrade unless/until the following lines are "remarked out" (prefix the lines with REM) in C:\xampp\php\pear.bat
ATTRIB +R %PHP_PEAR_BIN_DIR%\pear.bat >nul ATTRIB +R %PHP_PEAR_BIN_DIR%\peardev.bat >nul ATTRIB +R %PHP_PEAR_BIN_DIR%\pecl.bat >nulNow,
> pear upgrade pear… should work.
Pear.phar (a PEAR archive)
A single-archive-file PEAR installation (available here: http://greg.chiaraquartet.net) can be setup by typing from the command-line:
php go-pear.phar
In its current incarnation go-pear.phar neglects to append php.exe to the pear.bat … PHP_PEAR_PHP_BIN, which needs to be edited to look as follows:
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=C:\xampp\php\php.exe"Since the PHP CLI uses C:\xampp\php\php.ini, rather than C:\xampp\apache\bin\php.ini, go-pear.phar updates include_path in the former php.ini.
php pear.phar pearCommand
After PEAR is working (e.g. via go-pear.phar), the following installs the latest PHPdocumentor:
pear install –-onlyreqdeps channel://pear.php.net/phpdocumentor-1.3.0RC3Since Pear fetches from a *nix box, the “RC” part is case-sensitive.
The PHPdocumentor installation notified me that it depends on XML_Beautifier, which I installed via:
pear install –-onlyreqdeps XML_BeautifierRunning:
Pear remote-info phpdocumentorprovided the following guidance:
Pear’s web interface requires that Apache see Pear’s data_dir, as a subdirectory of /htdocs (or an Apache httpd.conf Alias to the PEAR data_dir) directory. The PHPdocumentor web interface is produced via:
http://localhost/peardata/PhpDocumentor… assuming that peardata is the Alias name for C:\php5\pear\data. Save yourself some head-scratching by making include_path in both php.ini’s (i.e. for Apache and for CGI) point to the same /pear/data/.
PEAR components
HTML_QuickForm
The value of using PEAR's HTML_QuickForm comes with validating and applying automated data filtering via rules and filters. Mixed HTML and PHP forms can lack clarity, compared to pure PHP forms. Using the same name for both database fields and form element names greatly simplifies populating default values and, later, building the SQL UPDATE statements. See: http://www.onlamp.com/pub/a/php/2004/07/22/html_quickform.html