Page 14 - Open Soource Technologies 304.indd
P. 14
Web Technologies-I
Notes and can be run from the command line and from your web server. PHP distributions bundle a
particular release of the PEAR Installer; on the other hand, go-pear gives you the newest stable
PEAR releases. However, go-pear does know your directory layout, but really contorts itself to
figure it out, and will try adapting your PEAR Installation to that. In this, you learn how to use
go-pear from the command line and web server, and on UNIX and Windows.
1.3.5 Prerequisites
Because go-pear is written in PHP, you need a CGI or CLI version of PHP to execute it outside
the web server. By default, the CLI version is installed along with your web server PHP module.
1998-2004 Zend Technologies. By default, the php command is installed in the /usr/local/bin
directory on UNIX, or c:\php on Windows. In Windows, the CLI version of PHP may also be
called php-cli; in that case, you need to type php-cli for every example that says just php.
1.3.6 Going PEAR
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.
$ 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 nO- http://go-pear.org php
Using fetch on FreeBSD:
$ fetch no n http://go-pear.org php
Using Perl LWPís GET utility:
$ GET http://go-pear.org php
On Windows, there is no one to fetch this URL tool, but you may be able to use PHP in 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 will install the PEAR packages bundled with
PHP: DB, Net_Socket, Net_SMTP, Mail, XML_Parser, PHPUnit.
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.
8 LOVELY PROFESSIONAL UNIVERSITY