How do I Install Pear on Wampserver on Windows?
Posted by: JanLamprecht (---.fnb.co.za)
Date: January 10, 2014 03:49PM

Version of Operating system?
Windows 7 64 bit

Version of Wamp Server installed?
Wamp Server 2.1

Version of Apache you are running?
2.2.17

Version of MySQL you are running?
5.1.53

Version of PHP you are running?
PHP 5.3.4

What colour is your WampManager icon? ( the in the system tray )
Green

Do you have a HOSTS file? [c:\windows\system32\drivers\etc\hosts]
Yes.

Paste any entries relating to the domain localhost and also any relating to your Virtual Hosts if you have any.
127.0.0.1 localhost127.0.0.1 localhost127.0.0.1 localhost127.0.0.1 localhost
10.33.153.71 mavenrepo

My Question:
What is the easiest way to install Pear on to this version of WampServer?

Options: ReplyQuote
Re: How do I Install Pear on Wampserver on Windows?
Posted by: RiggsFolly (---.as13285.net)
Date: January 10, 2014 04:54PM

Before you do this, make sure the pear stuff you want is compiled for 64 bit, otherwise you will have to install the 32bit wamp before you do this




Create a new folder 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 )
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
from the command line do this :

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

Alternatively, I have a batch file which I save into a folder that is always on my windows path, lets call it php-command-line.bat and I add this to that file
path=%path%;c:\wamp\bin\php\php5.3.17;c:\wamp\bin\mysql\mysql5.5.28\bin
php -v

I can then start a command window anytime I like and just keyin >php-command-line and I have access to the php.exe in any folder I may wish to code up and run some php CLI source code.

>php go-pear.phar


D:\wamp\bin\php\php5.4.11>php PEAR\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\php5.4.11
 2. Temporary directory for processing            : D:\wamp\bin\php\php5.4.11\tmp
 3. Temporary directory for downloads             : D:\wamp\bin\php\php5.4.11\tmp
 4. Binaries directory                            : D:\wamp\bin\php\php5.4.11
 5. PHP code directory ($php_dir)                 : D:\wamp\bin\php\php5.4.11\pear
 6. Documentation directory                       : D:\wamp\bin\php\php5.4.11\docs
 7. Data directory                                : D:\wamp\bin\php\php5.4.11\data
 8. User-modifiable configuration files directory : D:\wamp\bin\php\php5.4.11\cfg
 9. Public Web Files directory                    : D:\wamp\bin\php\php5.4.11\www
10. Tests directory                               : D:\wamp\bin\php\php5.4.11\tests
11. Name of configuration file                    : D:\wamp\bin\php\php5.4.11\pear.ini
12. Path to CLI php.exe                           : D:\wamp\bin\php\php5.4.11

1-12, 'all' or Enter to continue:
Beginning install...
Configuration written to D:\wamp\bin\php\php5.4.11\pear.ini...
Initialized registry...
Preparing to install...
installing phar://D:/wamp/bin/php/php5.4.11/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.7.tar...
installing phar://D:/wamp/bin/php/php5.4.11/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.3.0.tar...
installing phar://D:/wamp/bin/php/php5.4.11/PEAR/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.9.4.tar...
installing phar://D:/wamp/bin/php/php5.4.11/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.4.tar...
installing phar://D:/wamp/bin/php/php5.4.11/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\php5.4.11\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\php5.4.11\php.ini>? [Y/n] : n

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

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

The 'pear' command is now at your service at d:\wamp\bin\php\php5.4.11\pear.bat


TEST THAT IS WORKS
>pear

Should show you something like this

D:\wamp\bin\php\php5.4.11>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\php5.4.11>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
Re: How do I Install Pear on Wampserver on Windows?
Posted by: JanLamprecht (---.telkomadsl.co.za)
Date: January 11, 2014 11:35PM

Thank you very much for that detailed answer. I would like to clarify some things.

1. My initial need is the PHP Mail - but in the long term I would like to use a lot more PEAR packages. You say I must check that its compiled in 64 bit. I went there: [pear.php.net] - and I don't know where to find whether it is compiled in 64 bit.

2. Do you think that it is better for me to rather use Wampserver 32bit on my 64 bit machine - would that be safer and would that give me access to all the pear modules rather?

Options: ReplyQuote
Re: How do I Install Pear on Wampserver on Windows?
Posted by: RiggsFolly (---.as13285.net)
Date: January 13, 2014 11:49AM

Yes I personally think you are more likely to find valid extensions in the 32 bit environment.

---------------------------------------------------------------------------------------------
(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
Re: How do I Install Pear on Wampserver on Windows?
Posted by: GerHobbelt (---.cm-7-2b.dynamic.ziggo.nl)
Date: September 28, 2014 07:29AM

FYI:

when running the above installation on wampserver 2.5/64b (PHP: C:\wamp\bin\php\php5.4.12) it turns out that pear is badly configured and attempts to edit C:\Windows\pear.ini when you do things like

pear config-set doc_dir blahblahblahblah

The trick is to ensure that *PEAR.php* sees the `-C pear.ini` commandline parameter every time it executes as either PEAR or PECL. The fastest way to accomplish is by editing the pear.bat and pcl.bat files like the line shown below. Do note that the `-C pear.ini` bit is placed *after* the double dash `--`: this is crucial to make pear/pecl behave.

The new line near the bottom in pear.bat:

"%PHP_PEAR_PHP_BIN%" -C -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d register_argc_argv="On" -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- -C "pear.ini" %1 %2 %3 %4 %5 %6 %7 %8 %9

Edit the `pecl.bat` file the same way.

Options: ReplyQuote


Sorry, you can't reply to this topic. It has been closed.