Cover image for post Set up your own PEAR channel

Set up your own PEAR channel

UPDATE: This guide to set up a PEAR channel server has been deprecated by this howto, written by Greg Beaver. Anyway, the following text might still give you a few good hints.

Another little tutorial in my little series on PEAR 1.4, which has been released gracefully a couple of hours ago in it's first alpha versions. This time, I will give you some hints on setting up your own PEAR channel server.

Btw. you can discover and use my onw little test channel (as long as I'm online at home), using (PEAR 1.4 presumed):

pear channel-discover pear.schlitt.info pear install -f schlitt/Services_Trackback

A working PEAR 1.4 installation presumed.

Preconditions

Precodinditions for the installation of PEAR_Server are the following:

  • PHP 5.0.3 (or later).

  • PEAR 1.4.0a2 (or later) installed.

  • Access to a MySQL database.

  • A full qualified domain name to run the server in a dedicated environment.

Basic info's on how to install PHP5 can be found here. MySQL and a domain name (such as pear.schlitt.info) seem to be common preconditions and need no further introduction. The dependency to a domain name will be dropped in future.

Warning

Warning: What follows is the handling of software which is rated "alpha" quality. NEVER use this in a production environment. Everything you do from this point on is at your own risk.

Getting PEAR 1.4

To get an actual version of PEAR use go-pear.org (if you have no running PEAR installation, yet) and type

pear clear-cache pear upgrade PEAR

If you have problems installing this version, it maybe you have set another preferred_state than "alpha" (of course, this is nothing wrong!). To self this problem simple us

pear upgrade -f PEAR

which allows you to install the package even if it's not available in your preferred state. Finishing this, you've upgraded to PEAR 1.4. Easy, wasn't that? ;)

Discovering a channel

Next thing todo is discovering Gregs channel, which is located at pear.chiaraquartet.net, because the PEAR_Server package is not officially released, yet:

pear channel-discover pear.chiaraquartet.net

The channel.xml for this channel is automatically downloaded and the channel is registered locally. Some more info is provided by pear list-channels and pear channel-info chiara. As one can see here, the channel also publicated it's shortcut (chiara) to our PEAR installer.

Installing PEAR_Server

Now we will go on installing the PEAR_Server package, which should work like a charme when typing

pear install -f --alldeps PEAR_Server

if that does not work (I experienced problems with the channel and channel name resolutions in an older version), try one of the following:

pear install -f --alldeps chiara/PEAR_Server pear install -f --alldeps pear.chiaraquartet.net/PEAR_Server

Finishing installation, the installer will tell us, that the package PEAR_Server has some post-install script to run. This should be done now, if all preconditions are fulfilled (meaning a virgin MySQL database, proper credentials for that and a virgin htdocs root):

pear run-scripts PEAR_Server

You will be asked several questions about your database, the htdocs, the details of your channel and you as the intial administrator. If everything works correct, the PEAR installer should create necessary tables and entries inside the database (4 tables and some entries for the user and the channel) and create the directory structure of your channel server below the htdocs directory you provided. Your channel should also be registered in your PEAR installer immediatelly.

Manual adjustments

Some adjustments have to be done to the current installation. First of all, the creation of an index.htm is recommended in the htdocs folder, to avoid people browsing the directory. Next is to rename the file frontend.php (created by the installer) to any other name to avoid people accessing your admin interface.

Adding a release

The admin interface brings us to the next steps. Open the website http:://your.channel.domain/your_frontend_filename.php in a webbrowser, you should get a login form. Provide your user credentials, chosen during the installation and enter the administration of your PEAR server.

What we have to do first is register a new package. Enter the necessary info about your package (especially the correct name) and submit the form. After that we need edit the recently created package again. Doing this a new link appears beside the package details form named "Manage Package Maintainers". Here we should add ourself as the lead maintainer of the package, so we can upload releases.

So, what we need now is a package release to upload. The release package must fulfill the following preconditions:

  • Having a package2.xml (so being build by PEAR 1.4).

  • Your channel configured in the package2.xml.

I provided information on how to deal with package2.xml in my last article. Simply replace the pear.php.net inside the <channel /> tag with the URI of your channel. Having build that package correctly, you might upload it through the webinterface of your server.

Testing your channel

Congratulations, you have recently set up your own PEAR channel, which provides the first release. :)

Testing your own channel is very easy, simply try to install the package you recently added to the channel using:

pear install Your_Package_Name

Please note, that package names currently seem to be casesensitive (in some cases). If the shown syntax does not work, please try using one of the following:

pear install your_channel_alias/Your_Package_Name pear install your_channel_URI/Your_Package_Name

One of those commaned should work, if it doesn't something might be wrong with your server or client installation.

Support

If you experience any difficulties while processing the above shown steps, please first try debugging a little bit yourself using the verbose option of the PEAR installer. Next steps for getting help should be a) emailing pear-general and/or b) asking for help in #pear on Efnet. If you're sure to have found a bug, please file a bug report at pear.php.net.

Comments

Note that unless you

$ pear config-set default_channel chiara

you will always need to prefix a package name with the channel as in chiara/PEAR_Server.

If it works without this, that's a bug :)

Also, don't forget to channel-discover your own channel before you attempt to administer in the frontend.

Another neat trick is the auto_discover configuration variable. If you set it to 1 as in:

$ pear config-set auto_discover 1

then this will work

$ pear install pear.chiaraquartet.net/PEAR_Server

without the need of channel-discover.

However, this is disabled by default, and I would only enable it on a private local installation for security reasons.

Greg

Greg Beaver at 2005-02-27

I have posted an up-to-date tutorial on setting up a channel server on my blog at http://greg.chiaraquartet.net/archives/123-Setting-up-your-own-PEAR-channel-the-official-way.html

This supersedes all the information here.

Cheers, Greg

Greg Beaver at 2006-03-30