Установка PEAR в PHP 5.4.х под Windows, собственно как и PHP 5.3.х под Windows, является затруднительной в силу отсутствия в этих версиях инсталлятора go-pear.phar. В версиях PHP 5 до 5.2.х включительно инсталлятор go-pear.phar присутствовал в каталоге ./PEAR/ корневого каталога PHP, который можно было запустить файлом go-pear.bat из того же корневого каталога PHP.
В PHP 5.4.х под Windows, собственно как и PHP 5.3.х под Windows, инсталлятор go-pear.phar и go-pear.bat по умолчанию отсутствуют но, зато появился phar.phar.bat и следует отметить, что phar.phar.bat не go-pear.bat и для установки PEAR он нам не пригодится!:
PHAR — это утилита для создания исполняемых архивов в PHP, аналог JAR в Java.
PHAR ползволяет упаковать много файлов в один, в результате чего Ваше приложение может работать с целой библиотекой, как с одним файлом.
PHAR умеет создавать, читать, записывать и конвертировать такие форматы, как TAR, ZIP и, собственно, PHAR.
Доступ к файлам в архиве осуществляется напрямую, без необходимости распаковки архива, через PHP Stream Wrapper, тоесть с файлами из архива работают все функции, которые поддерживают PHP Stream Wrapper.
Справку по сему чуду PHAR можно получить выполнив phar.phar.bat help, а для установки PEAR в PHP 5.4.х под Windows, собственно как и PHP 5.3.х под Windows, обратимся к рекомендации официального мануала по установке PEAR под Windows следуя которым мы сначала выполняем "update your PEAR installation" скачивая свежую версию инсталлятора go-pear.phar с адреса http://pear.php.net/go-pear.phar и запихиваем его в каталог ./PEAR/ корневого каталога PHP - собственно можно вырвать ./PEAR/go-pear.phar и ./go-pear.bat из PHP версии 5.2 и после обновить go-pear.phar с адреса http://pear.php.net/go-pear.phar
Есть ещё одна версия инсталятораgo-pear non-pharred versionрасположенная по адресу http://pear.php.net/go-pear но, для PHP 5.4.х под Windows, собственно как и PHP 5.3.х под Windows, она нам не подходит:
>php -q go-pear PHP Warning: PHP Startup: Unable to load dynamic library '/PHP/54/ext/php_zip.d ll' - Не найден указанный модуль. in Unknown on line 0 Sorry! Your PHP version is too new (5.4.3) for this go-pear. Instead use http://pear.php.net/go-pear.phar for a more stable and current version of go-pear, more suited to your PHP version. Thank you for your coopertion and sorry for the inconvenience!
Нам говорят что наша версия РНР слишком новая для этой версии инсталятораgo-pearи вместо этой версии советуют использовать типа stable http://pear.php.net/go-pear.phar, что мы собственно и собрались делать.
"PHP Warning: PHP Startup: Unable to load dynamic library '/PHP/54/ext/php_zip.dll' - Не найден указанный модуль." даёт основания полагать, что PHP 5.4.х, собственно как и PHP 5.3.х, собирался (компилировался) без поддержки zip (php_zip.dll) и тулить php_zip.dll из PHP 5.2.х не имеет смыслы ибо получим что-то типа "точка входа в процедуру не найдена"! Просто закомментируем ";extension=php_zip.dll".
После того как обновили ./PEAR/go-pear.phar и содрали ./go-pear.bat из PHP 5.2.х или просто создали ./go-pear.bat:
Можно не создавать go-pear.bat и просто выполнить врукопашную:
php.exe -d output_buffering=0 PEAR\go-pear.phar или php.exe PEAR\go-pear.phar
Дальше выбираем способ установки (system|local). Разница между system и local состоит в том, что при выборе system файл конфигурации pear.ini будет в дельнейшем предложено по умолчанию сохранить в системном каталоге C:\WINDOWS\, а не в корневом ./ каталоге с PHP при выборе local. В нашем случае мы будем менять все каталоги по умолчанию в которых нам будет предложено установить PEAR и поэтому нам плевать что выбирать system или local и поэтому просто давим на <Enter> чем выбираем способ установки PEAR по умолчанию[system]:
php.exe PEAR\go-pear.phar Are you installing a system-wide PEAR or a local copy? (system|local) [system] : 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) : W:\PHP\54 2. Temporary directory for processing : W:\PHP\54\tmp 3. Temporary directory for downloads : W:\PHP\54\tmp 4. Binaries directory : W:\PHP\54 5. PHP code directory ($php_dir) : W:\PHP\54\pear 6. Documentation directory : W:\PHP\54\docs 7. Data directory : W:\PHP\54\data 8. User-modifiable configuration files directory : W:\PHP\54\cfg 9. Public Web Files directory : W:\PHP\54\www 10. Tests directory : W:\PHP\54\tests 11. Name of configuration file : C:\WINDOWS\pear.ini 12. Path to CLI php.exe : G:\PHP\54 1-12, 'all' or Enter to continue:
Теперь для отделения мух от котлет создадим отдельный каталог W:\LIBRARIES\PEAR для PEAR и сменим пути установки для всех 12-ти пунктов но, это нам не удастся если у нас отключен Windows Script Host:
1-12, 'all' or Enter to continue: 1 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) : CScript Error: Windows Scrip t Host access is disabled on this machine. Contact your administrator for detail s. 2. Temporary directory for processing : CScript Error: Windows Scrip t Host access is disabled on this machine. Contact your administrator for detail s.\tmp 3. Temporary directory for downloads : CScript Error: Windows Scrip t Host access is disabled on this machine. Contact your administrator for detail s.\tmp 4. Binaries directory : CScript Error: Windows Scrip t Host access is disabled on this machine. Contact your administrator for detail s. 5. PHP code directory ($php_dir) : CScript Error: Windows Scrip t Host access is disabled on this machine. Contact your administrator for detail s.\pear 6. Documentation directory : CScript Error: Windows Scrip t Host access is disabled on this machine. Contact your administrator for detail s.\docs 7. Data directory : CScript Error: Windows Scrip t Host access is disabled on this machine. Contact your administrator for detail s.\data 8. User-modifiable configuration files directory : CScript Error: Windows Scrip t Host access is disabled on this machine. Contact your administrator for detail s.\cfg 9. Public Web Files directory : CScript Error: Windows Scrip t Host access is disabled on this machine. Contact your administrator for detail s.\www 10. Tests directory : CScript Error: Windows Scrip t Host access is disabled on this machine. Contact your administrator for detail s.\tests 11. Name of configuration file : C:\WINDOWS\pear.ini 12. Path to CLI php.exe : G:\PHP\54 1-12, 'all' or Enter to continue:
Создаем параметр REG_DWORD с именем Enabled и значением 1 для включения Windows Script Host и перезапускаем консоль и снова выполняем "php.exe PEAR\go-pear.phar":
для текущего HKCU\Software\Microsoft\Windows Script Host\Settings\Enabled для всех HKLM\Software\Microsoft\Windows Script Host\Settings\Enabled
Но...., фухх..., если мы забаррикадировались по полной и в добавок используем "Политика ограниченного использования программ" (Police Softwарь Restriction) то получим очередной отлуп:
1-12, 'all' or Enter to continue: 1 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) : CScript Error: Execution of the Windows Script Host failed. (Невозможно открыть данную программу из-за полит ики ограничения применения программного обеспечения. За дополнительной информаци ей обратитесь к системному администратору или откройте "Просмотр событий". ) 2. Temporary directory for processing : CScript Error: Execution of the Windows Script Host failed. (Невозможно открыть данную программу из-за полит ики ограничения применения программного обеспечения. За дополнительной информаци ей обратитесь к системному администратору или откройте "Просмотр событий". )\tmp 3. Temporary directory for downloads : CScript Error: Execution of the Windows Script Host failed. (Невозможно открыть данную программу из-за полит ики ограничения применения программного обеспечения. За дополнительной информаци ей обратитесь к системному администратору или откройте "Просмотр событий". )\tmp 4. Binaries directory : CScript Error: Execution of the Windows Script Host failed. (Невозможно открыть данную программу из-за полит ики ограничения применения программного обеспечения. За дополнительной информаци ей обратитесь к системному администратору или откройте "Просмотр событий". ) 5. PHP code directory ($php_dir) : CScript Error: Execution of the Windows Script Host failed. (Невозможно открыть данную программу из-за полит ики ограничения применения программного обеспечения. За дополнительной информаци ей обратитесь к системному администратору или откройте "Просмотр событий". )\pea r 6. Documentation directory : CScript Error: Execution of the Windows Script Host failed. (Невозможно открыть данную программу из-за полит ики ограничения применения программного обеспечения. За дополнительной информаци ей обратитесь к системному администратору или откройте "Просмотр событий". )\doc s 7. Data directory : CScript Error: Execution of the Windows Script Host failed. (Невозможно открыть данную программу из-за полит ики ограничения применения программного обеспечения. За дополнительной информаци ей обратитесь к системному администратору или откройте "Просмотр событий". )\dat a 8. User-modifiable configuration files directory : CScript Error: Execution of the Windows Script Host failed. (Невозможно открыть данную программу из-за полит ики ограничения применения программного обеспечения. За дополнительной информаци ей обратитесь к системному администратору или откройте "Просмотр событий". )\cfg 9. Public Web Files directory : CScript Error: Execution of the Windows Script Host failed. (Невозможно открыть данную программу из-за полит ики ограничения применения программного обеспечения. За дополнительной информаци ей обратитесь к системному администратору или откройте "Просмотр событий". )\www 10. Tests directory : CScript Error: Execution of the Windows Script Host failed. (Невозможно открыть данную программу из-за полит ики ограничения применения программного обеспечения. За дополнительной информаци ей обратитесь к системному администратору или откройте "Просмотр событий". )\tes ts 11. Name of configuration file : C:\WINDOWS\pear.ini 12. Path to CLI php.exe : G:\PHP\54 1-12, 'all' or Enter to continue:
Потому как не смог выполнится \Temp\tmpA183.tmp\bf.vbs ибо был "ограничен Администратором по расположению правилом политики {6339da93-2186-4434-8138-769bd151ea38}, расположенной в \Temp". Ну, что ж - открываем mmc, идём в "Политика Локальный компьютер - Конфигурация Windows - Политика ограниченного использования программ - Дополнительные правила" и временно для каталога \Temp устанавливаем "Уровень безопасности" в "Неограниченный" и опять перезапускаем консоль и снова выполняем "php.exe PEAR\go-pear.phar"
G:\PHP\54>php.exe PEAR\go-pear.phar Are you installing a system-wide PEAR or a local copy? (system|local) [system] : 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) : G:\PHP\54 2. Temporary directory for processing : G:\PHP\54\tmp 3. Temporary directory for downloads : G:\PHP\54\tmp 4. Binaries directory : G:\PHP\54 5. PHP code directory ($php_dir) : G:\PHP\54\pear 6. Documentation directory : G:\PHP\54\docs 7. Data directory : G:\PHP\54\data 8. User-modifiable configuration files directory : G:\PHP\54\cfg 9. Public Web Files directory : G:\PHP\54\www 10. Tests directory : G:\PHP\54\tests 11. Name of configuration file : C:\WINDOWS\pear.ini 12. Path to CLI php.exe : G:\PHP\54 1-12, 'all' or Enter to continue: 1 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) : G:\LIBRARIES\PEAR 2. Temporary directory for processing : G:\LIBRARIES\PEAR\tmp 3. Temporary directory for downloads : G:\LIBRARIES\PEAR\tmp 4. Binaries directory : G:\LIBRARIES\PEAR 5. PHP code directory ($php_dir) : G:\LIBRARIES\PEAR\pear 6. Documentation directory : G:\LIBRARIES\PEAR\docs 7. Data directory : G:\LIBRARIES\PEAR\data 8. User-modifiable configuration files directory : G:\LIBRARIES\PEAR\cfg 9. Public Web Files directory : G:\LIBRARIES\PEAR\www 10. Tests directory : G:\LIBRARIES\PEAR\tests 11. Name of configuration file : C:\WINDOWS\pear.ini 12. Path to CLI php.exe : G:\PHP\54 1-12, 'all' or Enter to continue: 4 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) : G:\LIBRARIES\PEAR 2. Temporary directory for processing : G:\LIBRARIES\PEAR\tmp 3. Temporary directory for downloads : G:\LIBRARIES\PEAR\tmp 4. Binaries directory : G:\LIBRARIES\PEAR\bin 5. PHP code directory ($php_dir) : G:\LIBRARIES\PEAR\pear 6. Documentation directory : G:\LIBRARIES\PEAR\docs 7. Data directory : G:\LIBRARIES\PEAR\data 8. User-modifiable configuration files directory : G:\LIBRARIES\PEAR\cfg 9. Public Web Files directory : G:\LIBRARIES\PEAR\www 10. Tests directory : G:\LIBRARIES\PEAR\tests 11. Name of configuration file : C:\WINDOWS\pear.ini 12. Path to CLI php.exe : G:\PHP\54 1-12, 'all' or Enter to continue: 5 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) : G:\LIBRARIES\PEAR 2. Temporary directory for processing : G:\LIBRARIES\PEAR\tmp 3. Temporary directory for downloads : G:\LIBRARIES\PEAR\tmp 4. Binaries directory : G:\LIBRARIES\PEAR\bin 5. PHP code directory ($php_dir) : G:\LIBRARIES\PEAR\lib 6. Documentation directory : G:\LIBRARIES\PEAR\docs 7. Data directory : G:\LIBRARIES\PEAR\data 8. User-modifiable configuration files directory : G:\LIBRARIES\PEAR\cfg 9. Public Web Files directory : G:\LIBRARIES\PEAR\www 10. Tests directory : G:\LIBRARIES\PEAR\tests 11. Name of configuration file : C:\WINDOWS\pear.ini 12. Path to CLI php.exe : G:\PHP\54 1-12, 'all' or Enter to continue: 11 (Use $prefix as a shortcut for 'G:\LIBRARIES\PEAR', etc.) Name of configuration file [C:\WINDOWS\pear.ini] : $prefix\bin\pear.ini 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) : G:\LIBRARIES\PEAR 2. Temporary directory for processing : G:\LIBRARIES\PEAR\tmp 3. Temporary directory for downloads : G:\LIBRARIES\PEAR\tmp 4. Binaries directory : G:\LIBRARIES\PEAR\bin 5. PHP code directory ($php_dir) : G:\LIBRARIES\PEAR\lib 6. Documentation directory : G:\LIBRARIES\PEAR\docs 7. Data directory : G:\LIBRARIES\PEAR\data 8. User-modifiable configuration files directory : G:\LIBRARIES\PEAR\cfg 9. Public Web Files directory : G:\LIBRARIES\PEAR\www 10. Tests directory : G:\LIBRARIES\PEAR\tests 11. Name of configuration file : G:\LIBRARIES\PEAR\bin\pear.i ni 12. Path to CLI php.exe : G:\PHP\54 1-12, 'all' or Enter to continue: Beginning install... Configuration written to G:\LIBRARIES\PEAR\bin\pear.ini... Initialized registry... Preparing to install... installing phar://G:/PHP/54/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar- 1.3.3.tar... installing phar://G:/PHP/54/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Console_Geto pt-1.2.3.tar... installing phar://G:/PHP/54/PEAR/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.9.0.t ar... installing phar://G:/PHP/54/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_G raph-1.0.2.tar... installing phar://G:/PHP/54/PEAR/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.2 .1.tar... install ok: channel://pear.php.net/Archive_Tar-1.3.3 install ok: channel://pear.php.net/Console_Getopt-1.2.3 install ok: channel://pear.php.net/Structures_Graph-1.0.2 install ok: channel://pear.php.net/XML_Util-1.2.1 install ok: channel://pear.php.net/PEAR-1.9.0 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: <G:\LIBRARIES\PEAR\lib> 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 <G:\PHP\54\php.ini>? [Y/n] : n Please look over your php.ini file to make sure G:\LIBRARIES\PEAR\lib is in your include_path. Current include path : !! Configured directory : G:\LIBRARIES\PEAR\lib Currently used php.ini (guess) : G:\PHP\54\php.ini Press Enter to continue: ** WARNING! Old version found at G:\LIBRARIES\PEAR\bin, please remove it or be s ure to use the new g:\libraries\pear\bin\pear.bat command The 'pear' command is now at your service at g:\libraries\pear\bin\pear.bat * WINDOWS ENVIRONMENT VARIABLES * For convenience, a REG file is available under G:\LIBRARIES\PEAR\PEAR_ENV.reg . This file creates ENV variables for the current user. Double-click this file to add it to the current user registry.
include_path в нашем php.ini к /LIBRARIES/PEAR/lib прописан относительный ибо веб-сервант (РНР соответственно) работает на виртуальном диске "W:\" и нас это устраивает, путь к G:\LIBRARIES\PEAR\bin в системной переменной Path уже был прописан до начала установки самого PEAR. PEAR_ENV.reg содержит импортируемые в реестр переменные для текущего пользователя, обычно его импорт в реестр особой погоды не делает но, по желанию можно импортировать авось переменные и пригодятся.
Установка PEAR в PHP 5.4.х под Windows, может считаться завершённой. Теперь обратно забаррикадируемся отключив "Windows Script Host" и в "Политика Локальный компьютер - Конфигурация Windows - Политика ограниченного использования программ - Дополнительные правила" для каталога \Temp установим назад "Уровень безопасности" в "Не разрешено".
Проверим список установленных PEAR пакетов командой "pear list" и попробуем установить какой ни будь полезный пакет, например NET_DNSBL про использование которого подробнее напишем в другой раз если будем живы не помрём:
G:\PHP\54>pear install pear/NET_DNSBL WARNING: "pear/Net_DNS" is deprecated in favor of "pear/Net_DNS2" pear/HTTP_Request2 requires PEAR Installer (version >= 1.9.2), installed version is 1.9.0 pear/HTTP_Request2 requires package "pear/PEAR" (version >= 1.9.2), installed ve rsion is 1.9.0 pear/Net_DNSBL requires package "pear/HTTP_Request2" (version >= 2.0.0) downloading Cache_Lite-1.7.15.tgz ... Starting to download Cache_Lite-1.7.15.tgz (32,355 bytes) .........done: 32,355 bytes downloading Net_DNS-1.0.7.tgz ... Starting to download Net_DNS-1.0.7.tgz (32,647 bytes) ...done: 32,647 bytes downloading Net_URL2-2.0.0.tgz ... Starting to download Net_URL2-2.0.0.tgz (11,325 bytes) ...done: 11,325 bytes install ok: channel://pear.php.net/Cache_Lite-1.7.15 install ok: channel://pear.php.net/Net_DNS-1.0.7 install ok: channel://pear.php.net/Net_URL2-2.0.0 G:\PHP\54>pear install pear/NET_DNSBL WARNING: "pear/Net_DNS" is deprecated in favor of "pear/Net_DNS2" pear/HTTP_Request2 requires PEAR Installer (version >= 1.9.2), installed version is 1.9.0 pear/HTTP_Request2 requires package "pear/PEAR" (version >= 1.9.2), installed ve rsion is 1.9.0 pear/Net_DNSBL requires package "pear/HTTP_Request2" (version >= 2.0.0) No valid packages found install failed G:\PHP\54>pear upgrade-all Will upgrade channel://pear.php.net/archive_tar Will upgrade channel://pear.php.net/console_getopt Will upgrade channel://pear.php.net/pear Will upgrade channel://pear.php.net/structures_graph downloading Archive_Tar-1.3.10.tgz ... Starting to download Archive_Tar-1.3.10.tgz (18,294 bytes) ......done: 18,294 bytes downloading Console_Getopt-1.3.1.tgz ... Starting to download Console_Getopt-1.3.1.tgz (4,471 bytes) ...done: 4,471 bytes downloading PEAR-1.9.4.tgz ... Starting to download PEAR-1.9.4.tgz (296,332 bytes) ...done: 296,332 bytes downloading Structures_Graph-1.0.4.tgz ... Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes) ...done: 30,318 bytes upgrade-all ok: channel://pear.php.net/Archive_Tar-1.3.10 upgrade-all ok: channel://pear.php.net/Console_Getopt-1.3.1 upgrade-all ok: channel://pear.php.net/Structures_Graph-1.0.4 upgrade-all 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" G:\PHP\54>pear install pear/NET_DNSBL WARNING: "pear/Net_DNS" is deprecated in favor of "pear/Net_DNS2" downloading Net_DNSBL-1.3.7.tgz ... Starting to download Net_DNSBL-1.3.7.tgz (8,125 bytes) .....done: 8,125 bytes downloading HTTP_Request2-2.1.1.tgz ... Starting to download HTTP_Request2-2.1.1.tgz (99,151 bytes) ...done: 99,151 bytes install ok: channel://pear.php.net/HTTP_Request2-2.1.1 install ok: channel://pear.php.net/Net_DNSBL-1.3.7 G:\PHP\54>pear list INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET: ========================================= PACKAGE VERSION STATE Archive_Tar 1.3.10 stable Cache_Lite 1.7.15 stable Console_Getopt 1.3.1 stable HTTP_Request2 2.1.1 stable Net_DNS 1.0.7 stable Net_DNSBL 1.3.7 stable Net_URL2 2.0.0 stable PEAR 1.9.4 stable Structures_Graph 1.0.4 stable XML_Util 1.2.1 stable
По ходу установки Net_DNSBL мы обновили все пакеты и сам PEAR в том же числе с версии 1.9.0 до 1.9.4. Справку по командам pear можно получить набрав в консоли pear help.