PEARパッケージ インストール

Windows環境へのPEARパッケージのインストール手順と設定

パッケージの一覧を確認。

pear list INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET: ========================================= PACKAGE VERSION STATE Archive_Tar 1.3.11 stable Console_Getopt 1.3.1 stable PEAR 1.9.4 stable Structures_Graph 1.0.4 stable XML_Util 1.2.1 stable

パッケージの検索。

pear search w3c Retrieving data...0% .MATCHED PACKAGES, CHANNEL PEAR.PHP.NET: ======================================= PACKAGE STABLE/(LATEST) LOCAL Services_W3C_CSSValidator 0.2.3 (alpha) An Object Oriented Interface to the W3C CSS Validator service. Services_W3C_HTMLValidator 1.0.0 (stable) An Object Oriented Interface to the W3C HTML Validator service.

パッケージをインストール。

pear install Services_W3C_HTMLValidator pear/HTTP_Request2 can optionally use PHP extension "fileinfo" downloading Services_W3C_HTMLValidator-1.0.0.tgz ... Starting to download Services_W3C_HTMLValidator-1.0.0.tgz (13,598 bytes) .....done: 13,598 bytes downloading HTTP_Request2-2.1.1.tgz ... Starting to download HTTP_Request2-2.1.1.tgz (99,151 bytes) ...done: 99,151 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/Net_URL2-2.0.0 install ok: channel://pear.php.net/HTTP_Request2-2.1.1 install ok: channel://pear.php.net/Services_W3C_HTMLValidator-1.0.0

パッケージの一覧を再度確認。

pear list INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET: ========================================= PACKAGE VERSION STATE Archive_Tar 1.3.11 stable Console_Getopt 1.3.1 stable HTTP_Request2 2.1.1 stable Net_URL2 2.0.0 stable PEAR 1.9.4 stable Services_W3C_HTMLValidator 1.0.0 stable Structures_Graph 1.0.4 stable XML_Util 1.2.1 stable

実際に使用して動作確認。

PHP

require_once 'Services/W3C/HTMLValidator.php'; $validator = new Services_W3C_HTMLValidator(); $resources = $validator->validate('http://php.o0o0.jp/'); if ($resources->isValid()) { echo 'valid'; } else { echo 'invalid'; }

ERROR: failed to mkdir

pear.iniをC:\WINDOWS\pear.iniではなくC:\php\pear.iniなどに設置するとパッケージがインストールできないことがある。

ERROR: failed to mkdir C:\php\pear\docs\xxxxx\doc

pear.iniをC:\php-5.4.5\pear.iniに指定したのにも関わらず、C:\Windows\pear.iniになっている。 その影響でdoc_dirが存在しないディレクトリ(C:\php\pear\docs)を指定している。

pear config-show CONFIGURATION (CHANNEL PEAR.PHP.NET): ===================================== Auto-discover new Channels auto_discover <not set> Default Channel default_channel pear.php.net HTTP Proxy Server Address http_proxy <not set> PEAR server [DEPRECATED] master_server pear.php.net Default Channel Mirror preferred_mirror pear.php.net Remote Configuration File remote_config <not set> PEAR executables directory bin_dir C:\php-5.4.5 PEAR documentation directory doc_dir C:\php\pear\docs PHP extension directory ext_dir C:\php-5.4.5\ext PEAR directory php_dir C:\php-5.4.5\pear (略) PEAR password (for password <not set> maintainers) Signature Handling Program sig_bin c:\gnupg\gpg.exe Signature Key Directory sig_keydir C:\Windows\pearkeys Signature Key Id sig_keyid <not set> Package Signature Type sig_type gpg PEAR username (for username <not set> maintainers) User Configuration File Filename C:\Windows\pear.ini System Configuration File Filename C:\Windows\pearsys.ini

PEAR/Config.phpのpear.iniのパスを修正。

PHP

function PEAR_Config($user_file = '', $system_file = '', $ftp_file = false, $strict = true) { $this->PEAR(); PEAR_Installer_Role::initializeConfig($this); $sl = DIRECTORY_SEPARATOR; if (empty($user_file)) { if (OS_WINDOWS) { // pear.iniを設定 $user_file = 'C:\php-5.4.5\pear.ini'; // $user_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini'; } else { $user_file = getenv('HOME') . $sl . '.pearrc'; } } (略) }

pear.iniを再確認。

pear config-show CONFIGURATION (CHANNEL PEAR.PHP.NET): ===================================== Auto-discover new Channels auto_discover <not set> Default Channel default_channel pear.php.net HTTP Proxy Server Address http_proxy <not set> PEAR server [DEPRECATED] master_server pear.php.net Default Channel Mirror preferred_mirror pear.php.net Remote Configuration File remote_config <not set> PEAR executables directory bin_dir C:\php-5.4.5 PEAR documentation directory doc_dir C:\php-5.4.5\docs PHP extension directory ext_dir C:\php-5.4.5\ext PEAR directory php_dir C:\php-5.4.5\pear (略) PEAR password (for password <not set> maintainers) Signature Handling Program sig_bin c:\gnupg\gpg.exe Signature Key Directory sig_keydir C:\Windows\pearkeys Signature Key Id sig_keyid <not set> Package Signature Type sig_type gpg PEAR username (for username <not set> maintainers) User Configuration File Filename C:\php-5.4.5\pear.ini System Configuration File Filename C:\Windows\pearsys.ini

最新の記事

プロフィール

流されるままにウェブ業界で仕事しています。
主にLAPP環境でPHPを書いています。
最近はjQueryをよく書いています。