Installing PEAR packages creates a php5.6.15 directory
Posted by: SimonT (---.lightspeed.stlsmo.sbcglobal.net)
Date: June 25, 2016 05:23PM

This is a Window 7 64bit system.

I have WAMP 3.0.4 32bit installed

I originally installed 32bit from the file wampserver3_x86_apache2.4.17_mysql5.7.9_php5.6.15.exe

I was having virtual host problems with that version so I un-installed it and installed from wampserver3.0.4_x86_apache2.4.18_mysql5.7.11_php5.6.19-7.0.4.exe

Once I had that working, I downloaded the go-pear.phar file (PEAR install) and put it in the \php\php5.1.19 directory and ran it in a command prompt window to install PEAR - php go-pear.phar

It said it found an old copy of PEAR so I ran pear upgrade pear

It finished without any warnings or errors.

Then I installed a PEAR package, the name doesn't matter, I've tried other packages and the problem I'm having occurs with all of them.

The problem is, to me at least, strange -

PHP is installed in \php\php5.6.19 and that is where I put the go-pear.phar and where I run it from as CLI.

When I run pear install xxxxxx - xxxxxx can be anything, even the name of a non-existent package, it creates a new PHP directory under \php.

The name is php5.1.15 and it contains what looks like part of the PEAR files. If the package installed without errors or warnings, the package files will be in a subdirectory of the \php\php5.6.15\pear directory. The name of the subdirectory will be the package name. Thus Text_Highlighter was installed in \php\php5.6.15\pear\Text

As I said above, even if the package does not exist at pear.php.net, the php5.6.15 is created.

I wrote code to use the package and got it working as I wanted it. I merely "required" the package files in my PHP. I moved it to php\php5.6.19\pear\Text and was able to use it from there.

PEAR is simply a repository of packages and an update manager. To use PEAR packages, you don't need to actually installed PEAR, you can simply download the package file manually.

The question is: Why is pear install creating the php5.6.15 directory?

I searched the Windows Registry for the string 5.6.19, there were matches but they had nothing to do with PHP or PEAR.

I did a global file search of all files on the HDD for files containing the same string, 5.6.15 and the only matches were for things unrelated to PHP or PEAR.

My Environment variable PATH contains the directory \wamp32\bin\php\php5.6.19 - the correct directory.

There are Enviroment variables for the PEAR directories, here are the .reg statements that created them:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Environment]
"PHP_PEAR_SYSCONF_DIR"="C:\\wamp32\\bin\\php\\php5.6.19"
"PHP_PEAR_INSTALL_DIR"="C:\\wamp32\\bin\\php\\php5.6.19\\pear"
"PHP_PEAR_DOC_DIR"="C:\\wamp32\\bin\\php\\php5.6.19\\docs"
"PHP_PEAR_BIN_DIR"="C:\\wamp32\\bin\\php\\php5.6.19"
"PHP_PEAR_DATA_DIR"="C:\\wamp32\\bin\\php\\php5.6.19\\data"
"PHP_PEAR_PHP_BIN"="C:\\wamp32\\bin\\php\\php5.6.19\\.\\php.exe"
"PHP_PEAR_TEST_DIR"="C:\\wamp32\\bin\\php\\php5.6.19\\tests"

The only thing I could find , anywhere, which related to php5.6.15 was the actual installation file- wampserver3_x86_apache2.4.17_mysql5.7.9_php5.6.15.exe. It has php5.6.15 in its name. I deleted that file and the problem still exists.

So, why is "pear install xxxxx" creating a php5.6.15 directory?

How do I get it to install packages in the \php\php5.6.19\pear directory.

Does anyone have any ideas???

Options: ReplyQuote
Re: Installing PEAR packages creates a php5.6.15 directory
Posted by: Otomatic (Moderator)
Date: June 25, 2016 06:17PM

Hi,

> So, why is "pear install xxxxx" creating a php5.6.15 directory?
Only those who created the installation pear package can answer that question.

> My Environment variable PATH contains the directory \wamp32\bin\php\php5.6.19 - the correct directory.
With Wampserver, it is a very very bad idea to put the path to a PHP Version in the PATH environment variable.
When you change the PHP version, the path of the old version will still be activated and it will not be the right php.ini will be used.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Installing PEAR packages creates a php5.6.15 directory
Posted by: SimonT (---.lightspeed.stlsmo.sbcglobal.net)
Date: June 26, 2016 12:56AM

I was afraid you might say that.

I've been looking for a way to send them questions but haven't found any. I found two forums, one is not taking new registrations and the other one's registration procedure is not working properly.

I think that what I will do is let PEAR put the packages in \php5.6.15\pear and then I'll use them from there or copy them to the \php5.6.19\pear directory

I've written code and I find I can use the packages either way.

Regarding the path variable, I did that while trying to find away around the php5.6.15 problem. I am going to remove PHP from the path.

Thanks for the reply.

Options: ReplyQuote
Re: Installing PEAR packages creates a php5.6.15 directory
Posted by: RiggsFolly (Moderator)
Date: June 26, 2016 06:01PM

Is this any help?



How to install PEAR on a WAMP PHP Version
Create a new folder called PEAR below the folder containing the version of PHP you want to install PEAR extension into. eg c:\wamp\bin\php\php.x.y.z\PEAR ( I like a UPPER case name here but it does not have to be that way )

If the file 'go-pear.phar' does not exist in the php.x.y.z folder, get go-pear.phar from [pear.php.net], and save it into the php.x.y.z folder, the version you are using and want to download to.

Then you have to make sure you have the php.exe file on the windows PATH
We do not want to do this permanantly as that would mess up WAMPServers ability to switch PHP versions at the click of a button
So from the command line either do this :

path=%path%;c:\wamp\bin\php\phpx.y.z

( change x and y and z to the version numbers of your PHP )

Alternatively, I use a batch file which I save into a folder that is already on my windows path, lets call it `phppath.cmd` and I add this to that file

path=%path%;c:\wamp\bin\php\phpx.y.z
php -v


You can then start a command window anytime you like and just keyin `phppath` and it will add your PHP executable to the path for you for only the duration of the command window.

Now from a command window make sure you are in `wamp\bin\php\phpx.y.z` as we want PEAR installed in this folder and do :-

CD \wamp\bin\php\phpx.y.z
php go-pear.phar

Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : l
Please confirm local copy by typing 'yes' : yes

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 them or simply press Enter to
accept these locations.

1. Installation base ($prefix) : D:\wamp\bin\php\phpX.Y.Z
2. Temporary directory for processing : D:\wamp\bin\php\phpX.Y.Z\tmp
3. Temporary directory for downloads : D:\wamp\bin\php\phpX.Y.Z\tmp
4. Binaries directory : D:\wamp\bin\php\phpX.Y.Z
5. PHP code directory ($php_dir) : D:\wamp\bin\php\phpX.Y.Z\pear
6. Documentation directory : D:\wamp\bin\php\phpX.Y.Z\docs
7. Data directory : D:\wamp\bin\php\phpX.Y.Z\data
8. User-modifiable configuration files directory : D:\wamp\bin\php\phpX.Y.Z\cfg
9. Public Web Files directory : D:\wamp\bin\php\phpX.Y.Z\www
10. Tests directory : D:\wamp\bin\php\phpX.Y.Z\tests
11. Name of configuration file : D:\wamp\bin\php\phpX.Y.Z\pear.ini
12. Path to CLI php.exe : D:\wamp\bin\php\phpX.Y.Z

1-12, 'all' or Enter to continue:
Beginning install...
Configuration written to C:\wamp\bin\php\phpX.Y.Z\pear.ini...
Initialized registry...
Preparing to install...
installing phar://D:/wamp/bin/php/phpX.Y.Z/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.7.tar...
installing phar://D:/wamp/bin/php/phpX.Y.Z/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.3.0.tar...
installing phar://D:/wamp/bin/php/phpX.Y.Z/PEAR/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.9.4.tar...
installing phar://D:/wamp/bin/php/phpX.Y.Z/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.4.tar...
installing phar://D:/wamp/bin/php/phpX.Y.Z/PEAR/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.2.1.tar...
install ok: channel://pear.php.net/Archive_Tar-1.3.7
install ok: channel://pear.php.net/Console_Getopt-1.3.0
install ok: channel://pear.php.net/Structures_Graph-1.0.4
install ok: channel://pear.php.net/XML_Util-1.2.1
install ok: channel://pear.php.net/PEAR-1.9.4
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"

******************************************************************************
WARNING! The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
<D:\wamp\bin\php\phpX.Y.Z\pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.


Would you like to alter php.ini <D:\wamp\bin\php\phpX.Y.Z\php.ini>? [Y/n] : n

Please look over your php.ini file to make sure
D:\wamp\bin\php\phpX.Y.Z\pear is in your include_path.
Current include path : .;c:\wamp\bin\php\phpX.Y.Z\PEAR
Configured directory : D:\wamp\bin\php\phpX.Y.Z\pear
Currently used php.ini (guess) : D:\wamp\bin\php\phpX.Y.Z\php.ini
Press Enter to continue:

** WARNING! Old version found at D:\wamp\bin\php\phpX.Y.Z, please remove it or be sure to use the new d:\wamp\bin\php\phpX.Y.Z\pear.bat command

The 'pear' command is now at your service at d:\wamp\bin\php\phpX.Y.Z\pear.bat
[/code]


TEST THAT IS WORKS
>pear

Should show you something like this


D:\wamp\bin\php\phpX.Y.Z>pear
Commands:
build Build an Extension From C Source
bundle Unpacks a Pecl Package
channel-add Add a Channel
channel-alias Specify an alias to a channel name
channel-delete Remove a Channel From the List
channel-discover Initialize a Channel from its server
channel-info Retrieve Information on a Channel
channel-login Connects and authenticates to remote channel server
channel-logout Logs out from the remote channel server
channel-update Update an Existing Channel
clear-cache Clear Web Services Cache
config-create Create a Default configuration file
config-get Show One Setting
config-help Show Information About Setting
config-set Change Setting
config-show Show All Settings
convert Convert a package.xml 1.0 to package.xml 2.0 format
cvsdiff Run a "cvs diff" for all files in a package
cvstag Set CVS Release Tag
download Download Package
download-all Downloads each available package from the default channel
info Display information about a package
install Install Package
list List Installed Packages In The Default Channel
list-all List All Packages
list-channels List Available Channels
list-files List Files In Installed Package
list-upgrades List Available Upgrades
login Connects and authenticates to remote server [Deprecated in favor of channel-login]
logout Logs out from the remote server [Deprecated in favor of channel-logout]
makerpm Builds an RPM spec file from a PEAR package
package Build Package
package-dependencies Show package dependencies
package-validate Validate Package Consistency
pickle Build PECL Package
remote-info Information About Remote Packages
remote-list List Remote Packages
run-scripts Run Post-Install Scripts bundled with a package
run-tests Run Regression Tests
search Search remote package database
shell-test Shell Script Test
sign Sign a package distribution file
svntag Set SVN Release Tag
uninstall Un-install Package
update-channels Update the Channel List
upgrade Upgrade Package
upgrade-all Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]
Usage: pear [options] command [command-options] <parameters>
Type "pear help options" to list all options.
Type "pear help shortcuts" to list all command shortcuts.
Type "pear help <command>" to get the help for the specified command.

D:\wamp\bin\php\phpX.Y.Z>pear list-channels
REGISTERED CHANNELS:
====================
CHANNEL ALIAS SUMMARY
doc.php.net phpdocs PHP Documentation Team
pear.php.net pear PHP Extension and Application
Repository
pecl.php.net pecl PHP Extension Community Library
__uri __uri Pseudo-channel for static packages

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote


Sorry, only registered users may post in this forum.