php pear как установить
Как установить PEAR
Здравствуйте, уважаемые читатели блога LifeExample, на официальном сайте в мануале изложена инструкция о том, как установить PEAR. Но есть два неприятных момента, первое – инструкция на английском, второе – инструкция описывает процесс установки PEAR на unix системы.
Настоящих прожжённых web мастеров и сисадминов в одном лице, сей факт не испугает, но новички в программировании на PHP могут получить изрядный геморрой пытаясь установить PEAR на домашнюю Windows 7.
Дабы не позволить вам сложить руки, в процессе установки PEAR, я хочу поделиться своим опытом и рассказать, как установить PEAR на windows 7 с использованием набора denwer.
PEAR — это груша расширение к PHP, содержащие в себе набор полезных библиотек. Аббревиатура Pear расшифровывается как PHP Extension and Application Repository
Инструкция по установке PEAR на Denwer под Windows 7
На самом деле, совершенно не обязательно устанавливать пакет программ Denwer, можно воспользоваться настроенным вручную веб сервером, с установленным PHP, но так как статья рассчитана на новичков, которые чаще всего, для тестирования своих скриптов используют именно локальный сервер под началом денвера, то опираться мы будем имено на этот факт.
Если вместо похожего списка вы получаете ошибку:
То вам следует выполнить не хитрую операцию:
Теперь мы знаем, как установить PEAR на windows с денвером, и можем попробовать проинсталлировать какую-нибудь библиотеку, например phpDocumenor позволяющий создавать справочник к вашим скриптам по имеющимся комментариям.
C:\WebServers\usr\local\php5\pear.bat install pear/PhpDocumentor
Немного подождем завершения распаковки архива с phpDocumenor и снова проверим список доступных библиотек:
Ура! Библиотека установлена и готова к использованию:
О том, как пользоваться библиотекой читайте в следующей статье про phpDoc и генерацию справочника для php проекта. Подписывайтесь на рассылку, и не пропустите интересной статьи о phpDoc
Как установить PEAR, мы теперь знаем, но на этом я не хочу заканчивать статью. Если вы заметили то версии библиотек представленых на скриншотах, и вероятнее всего у вас являются далеко не последними, поэтому напрашивает законный вопрос: «Как обновить PEAR?«
Для того чтобы обновить Pear нужно выполнить команду
В результате мы получим список доступных для обновления библиотек с информацией о последних стабильных версиях и их размере.
Попробуем обновить библиотеку Archive_Tar, для этого выполним команду
C:\WebServers\usr\local\php5\pear.bat upgrade Archive_Tar
На что получим такой ответ:
Надеюсь теперь у вас не возникнет трудностей с обновлением библиотек PEAR и вопросом как установить PEAR.
Внимание! 1 октября блогу lifeexample.ru исполнится 1 год, в связи с этим я опубликую статью, которая должна была быть первой на этом блоге, но по ряду причин осталась в ящике стола и пролежала там целый год. Подписывайтесь на обновления.
Читайте также похожие статьи:
Чтобы не пропустить публикацию следующей статьи подписывайтесь на рассылку по E-mail или RSS ленту блога.
Getting and installing the PEAR package manager
Windows
After you have downloaded and installed PHP, you have to manually execute the batch file located in e.g. c:\php\go-pear.bat. The setup will ask you some questions and afterwards the PEAR Package Manager will be installed in the path, which you have specified during installation.
Finally you have to add that installation path to your PATH environment. Either do this manually (Start > Control Panel > System > Environment) or run (double-click) the newly generated PEAR_ENV.reg that’s now found in the PHP source directory.
After that you can access the PEAR Package Manager by running the command pear in a Windows Command Prompt.
To update your PEAR installation, request http://pear.php.net/go-pear.phar in your browser and save the output to a local file go-pear.phar. You can then run
in a Windows Command Prompt to start the update process.
Unix/Linux/BSD
If one uses a version of PHP that is supplied by Unix/Linux/BSD distributors it may be necessary to manually install PEAR. Users should consult the documentation for the respective distribution in this case.
If you want to re-install the Package Manager, you can use the following provisional way:
Some Linux distributions (e.g. Redhat) seem to be using links instead of lynx as the name for their command line browser. If this is the case for you, you need to change the above line correspondingly.
Mac OS X
On Mac OS 10.4 and earlier, the PEAR Package Manager is already installed in /usr/bin/pear.
If you are using Mac OS 10.5 (Leopard), would like to install a new copy, or re-install the PEAR Package Manager use the following command:
For a system-wide installation, you will need to execute the go-pear script with increased permissions. This is only recommended for advanced users.
PEAR in hosting environments
If you are running your site at a web hosting provider with no direct access to the server (via local logins, Telnet or SSH), you can use the PEAR Installer using the Web Frontend or (S)FTP.
Getting and installing the PEAR package manager
Windows
in a Windows Command Prompt to start the installation.
The setup will ask you some questions and afterwards the PEAR Package Manager will be installed in the path, which you have specified during installation.
Finally you have to add that installation path to your PATH environment. Either do this manually (Start > Control Panel > System > Environment) or run (double-click) the newly generated PEAR_ENV.reg that’s now found in the PHP source directory.
After that you can access the PEAR Package Manager by running the command pear in a Windows Command Prompt.
Unix/Linux/BSD
If one uses a version of PHP that is supplied by Unix/Linux/BSD distributors it may be necessary to manually install PEAR. Users should consult the documentation for the respective distribution in this case.
If you want to re-install the Package Manager, you can use the following provisional way:
Please note, you may need to install the wget package via your Unix/Linux/BSD package manager. On Debian and Ubuntu this is done via:
Alternatively, download the go-pear.phar file via your browser.
If the process just exits without any output, your syslog will probably contain the following lines:
To work around this problem, enable the phar in /etc/php5/conf.d/suhosin.ini :
Mac OS X
Use curl as shown below to download the go-pear.phar file or just download the go-pear.phar file via your browser.
You’re now ready to configure PEAR for installation.
First you need to change the Installation Base.
So type 1, and then press Enter.
Then, you will need to change the Binaries directory.
Type 4, and then press Enter.
Once you have changed the Installation Base and the Binaries Directory, press Enter to install PEAR.
For a system-wide installation, you will need to execute the go-pear script with increased permissions. This is only recommended for advanced users.
PEAR in hosting environments
If you are running your site at a web hosting provider with no direct access to the server (via local logins, Telnet or SSH), you can use the PEAR Installer using the Web Frontend or (S)FTP.
Установка PEAR со сборкой OpenServer (PHP 5.5.4 + Apache 2.4.6)
В одном из прошлых постов мы рассказывали про PEAR, это, так сказать, вводная статья или краткий ликбез что такое PEAR.
Теперь настало то самое время, чтобы установить его на наш компьютер.
Замечание. Предполагается, что у вас установлен уже рабочий сервер с интерпретатором PHP 5.x.x, насчет ранних версий не знаю, не устанавливал.
1). Для начала нам необходимо скачать дистрибутив с официального сайта, который доступен по оригинальной ссылке http://pear.php.net/go-pear.phar и весит где-то 4 мБ.
Следует отметить, что PEAR может уже быть в дистрибутиве PHP 5, если нет то скачайте и добавьте его, как выше указано ;
2). Открываем окно командной строки и перемещаемся в папку PEAR в установленном PHP, набрав команду:
Следует отметить, что файл go-pear.bat может уже быть в дистрибутиве, если нет то добавьте его, как выше указано с кодом;
4). Открываем окно командной строки и заходим в папку с файлом go-pear.bat, набрав следующую команду:
и жмем на ENTER, мы запусти файл go-pear.bat и на экране выводится текст с просьбой подтверждения и вводим букву l + yes,
конфигурационному файлу pear.ini, который находится в корневой папке PHP, иначе говоря вводим путь к этому файлу в виде C:\OpenServer\modules\php\PHP-5.5.4\pear.ini и жмем ENTER. Далее жмем цифру 12 и жмем ENTER,
вводим путь к корневой папке PHP C:\OpenServer\modules\php\PHP-5.5.4 и жмем ENTER и еще раз ENTER.
7). Создаем в корне PHP файл pear.bat со следующим кодом :
8). В корне создадим еще один файл go-pear-conf.bat для донастройки конфигурационного файла pear.ini со следующим кодом:
и запускаем его через командную строку;
10). В дистрибутиве PHP 5.5.x PEAR уже включена и необходимость в скачивании отпадает, только если вы не хотите обновить PEAR, нужно отметить, что данная настройка проводилась со сборкой OpenServer, так что, если вы настраиваете локальный сервер на других сборках на подобие Денвера, то особой разницы нет, главное присмотреть, чтобы пути к корневым папкам и файлам совпадали. Удачного дня! );
Getting and installing the PEAR package manager
Windows
in a Windows Command Prompt to start the installation.
The setup will ask you some questions and afterwards the PEAR Package Manager will be installed in the path, which you have specified during installation.
Finally you have to add that installation path to your PATH environment. Either do this manually (Start > Control Panel > System > Environment) or run (double-click) the newly generated PEAR_ENV.reg that’s now found in the PHP source directory.
After that you can access the PEAR Package Manager by running the command pear in a Windows Command Prompt.
Unix/Linux/BSD
If one uses a version of PHP that is supplied by Unix/Linux/BSD distributors it may be necessary to manually install PEAR. Users should consult the documentation for the respective distribution in this case.
If you want to re-install the Package Manager, you can use the following provisional way:
Please note, you may need to install the wget package via your Unix/Linux/BSD package manager. On Debian and Ubuntu this is done via:
Alternatively, download the go-pear.phar file via your browser.
If the process just exits without any output, your syslog will probably contain the following lines:
To work around this problem, enable the phar in /etc/php5/conf.d/suhosin.ini :
Mac OS X
Use curl as shown below to download the go-pear.phar file or just download the go-pear.phar file via your browser.
You’re now ready to configure PEAR for installation.
First you need to change the Installation Base.
So type 1, and then press Enter.
Then, you will need to change the Binaries directory.
Type 4, and then press Enter.
Once you have changed the Installation Base and the Binaries Directory, press Enter to install PEAR.
For a system-wide installation, you will need to execute the go-pear script with increased permissions. This is only recommended for advanced users.
PEAR in hosting environments
If you are running your site at a web hosting provider with no direct access to the server (via local logins, Telnet or SSH), you can use the PEAR Installer using the Web Frontend or (S)FTP.