Re: conflict with PEAR2 standards and PEAR 1
| From: | Greg Beaver | Date: | Tue, 26 May 2009 04:03:33 +0000 |
| Subject: | Re: conflict with PEAR2 standards and PEAR 1 | ||
| References: | 1 2 | Groups: | php.pear.core |
| Request: | Send a blank email to pear-core+get-8439@lists.php.net to get a copy of this message | ||
Chuck Burgess wrote:
> I thought the src/ folder was only a PEAR2 requirement in the CVS
> directory layout for the package. I was thinking that the "role=php"
> setting is where the files from the package's src/ subdir would be
> installed... regardless of the PEAR1 installation's php_dir setting,
> be it the default php/ or not, the files install to there, period. Am
> I misunderstanding this, from the installation perspective?
Hi,
This was changed in Pyrus because of the simple fact that a registry is
tightly bound to php_dir (it actually resides in php_dir in PEAR), but a
configuration is not.
Thus, imagine this setup:
php_dir => /usr/local/lib/php
data_dir => /usr/local/lib/data
Now we do this change:
pear config-set php_dir /usr/my/actual/php
Suddenly, everything you've installed disappears - but the data_dir
files still live in /usr/local/lib/data. We have essentially orphaned
our PEAR installation through changing a configuration variable.
In PEAR, all configuration is stored separately from the installation.
Pyrus changes this by splitting configuration into installation-specific
config and user-specific config. Try "php pyrus.phar config-show" to
see how they are split. User-specific config is stored in
~/.pear/pearconfig.xml (or user-specific My Documents\pearconfig.xml on
windows), and installation-specific config is stored right in the
installation, just like the registry is. Thus, it is no longer possible
to change the php_dir to anything outside of the location of the install.
Another change made in Pyrus is that the registry is no longer stored
directly in the php_dir, but one directory up, so php_dir is always
<pear install location>/src.
The point of making both php_dir and data_dir static relative to the
pear installation is that it allows www files to rely fully on being
able to locate the PHP files in order to include them, and the data
files using relative paths. This makes it possible to write
applications that work both as installed and as extracted. This is a
prime design feature of Pyrus and of PEAR2, and was hashed out in
endless discussions which clearly made very little impression on anyone
but me :).
One other reason there is never any point to allowing php_dir to be
changed is that unlike PEAR, Pyrus allows cascading registries (and not
cascading configurations since there is no need), so if you need another
newer package to take precedence, change your include_path and make a
new Pyrus installation that is higher up in the include_path. Pyrus
will use the other install to validate dependencies.
The main thing to take into account here is to ask yourself a simple
question: when have you ever felt the need to change php_dir or
data_dir? These directories simply don't *need* to be changed, and it
doesn't really make sense to change them, especially when you can easily
have multiple PEAR installations managed seamlessly by Pyrus. By making
this explicit, it opens up a huge range of possibilities for flexible
applications and libraries that can be designed for quick
try-before-you-commit(-or-buy) via download/extract and later commitment
by running php pyrus.phar /path/to/pearinstall upgrade Packagename.
One question to consider is who will benefit by changing from php/ to
src/? The change will make it more difficult for existing users of PEAR
to upgrade to using Pyrus. Is there some huge group of people who are
avoiding PEAR because it installs into php/ that we will gain by
switching to src/?
Greg