Page 66 - Open Soource Technologies 304.indd
P. 66
Unit 5: PHP
5.2.6 Going PEAR Notes
If your PHP install did not include PEAR, you can use go-pear as a universal PEAR bootstrapper.
All you need is a CLI or CGI version of PHP installed somewhere. You can download the
go pear script and execute it, or run it all in one command, like this:
$ lynx –source http://go-pear.org | php This command simply takes the contents of http://
go pear.org and sends it to PHP for execution.
If you do not have lynx available on your system, try an alternative way of executing go-pear
directly:
Using GNUS wget:
$ wget –O- http://go-pear.org | php
Using fetch on FreeBSD:
$ fetch –o – http://go-pear.org | php
Using Perl LWP’s GET utility:
$ GET http://go-pear.org | php
On Windows, there is no “fetch this URL” tool, but you may be able to use PHP’s URL streams
(make sure that url_includes is not disabled in your php.ini file):
C:\> php-cli –r “include(‘http://go-pear.org’);”
If none of this works, open http://go-pear.org in your browser, save the contents as go-pear.
php and simply run it from there:
C:\> php go-pear.php
The output will look like this:
Welcome to go-pear!
Go-pear will install the ‘pear’ command and all the files needed by it. This command is your
tool for PEAR installation and maintenance. Go-pear also lets you download and install the
PEAR packages bundled with PHP: DB, Net_Socket, Net_SMTP, Mail, XML_Parser, PHPUnit.
If you wish to abort, press Control-C now, or press Enter to continue:
This greeting tells you what you are about to start. Press Enter for the first real question:
HTTP proxy (http://user:password@proxy.myhost.com:port), or Enter for none:
Go-pear checks your http_proxy environment variable and presents the value of that as the
default value if http_proxy is defined. If you want to use an HTTP proxy when downloading
packages, enter the address of it here, or just press Enter for “no proxy.”
Now, on to the interesting part: Below is a suggested file layout for your new PEAR installation.
To change individual locations, type the number in front of the directory. Type ‘all’ to change
all of then, or simply press Enter to accept these locations:
LOVELY PROFESSIONAL UNIVERSITY 61