コンテンツへスキップ

Raspberry Pi にPHP PEARライブラリー導入

PHPのPEARライブラリーをインストール

開発自体は、できる限り手間をかけずに各種実装を進めているのですが、プログラム言語により各種フレームワークが準備されております。
最近の利用実態は分かりませんが、以前はPHPのPEARは、各所で利用されておりました。
Raspberry Piに導入した際の手順を公開します。

マニュアルでインストールしようとしたのですが、apt-getしたソフトで全く問題なかったので、簡単な手順となりました。
DBを例に、個別の機能をインストールする際の例も記載しております。

sudo apt-get install php-pear
sudo pear update-channels
sudo pear upgrade-all
sudo pear install DB

導入時点では、以下のパッケージがインストールされていました。

  • Archive_Tar 1.4.7 stable
  • Console_Getopt 1.4.2 stable
  • PEAR 1.10.9 stable
  • PEAR_Manpages 1.10.0 stable
  • Structures_Graph 1.1.1 stable
  • XML_Util 1.4.3 stable

以下、コマンド抜粋です。

@raspberrypi:~ $ sudo apt-get install php-pear
[sudo] パスワード:
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
php-pear はすでに最新バージョン (1:1.10.6+submodules+notgz-1.1) です。
php-pear は手動でインストールしたと設定されました。
アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。

@raspberrypi:~ $ pear -h
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 version" or "pear version" to list version information.
Type "pear help <command>" to get the help for the specified command.

@raspberrypi:~ $ sudo pear update-channels
Updating channel "doc.php.net"
could not create lock file: fopen(/usr/share/php/.lock): failed to open stream: Permission denied
Updating channel "pear.php.net"
could not create lock file: fopen(/usr/share/php/.lock): failed to open stream: Permission denied
Updating channel "pecl.php.net"
could not create lock file: fopen(/usr/share/php/.lock): failed to open stream: Permission denied
miki@raspberrypi:~ $ sudo pear update-channels
Updating channel "doc.php.net"
Update of Channel "doc.php.net" succeeded
Updating channel "pear.php.net"
Update of Channel "pear.php.net" succeeded
Updating channel "pecl.php.net"
Update of Channel "pecl.php.net" succeeded

@raspberrypi:~ $ sudo pear upgrade-all
Will upgrade channel://pear.php.net/console_getopt
Will upgrade channel://pear.php.net/archive_tar
Will upgrade channel://pear.php.net/pear
WARNING: "pear/Console_Getopt" is deprecated in favor of "pear/Console_GetoptPlus"
downloading Console_Getopt-1.4.2.tgz ...
Starting to download Console_Getopt-1.4.2.tgz (5,736 bytes)
.....done: 5,736 bytes
downloading Archive_Tar-1.4.7.tgz ...
Starting to download Archive_Tar-1.4.7.tgz (21,134 bytes)
...done: 21,134 bytes
downloading PEAR-1.10.9.tgz ...
Starting to download PEAR-1.10.9.tgz (291,931 bytes)
...done: 291,931 bytes
upgrade-all ok: channel://pear.php.net/Console_Getopt-1.4.2
upgrade-all ok: channel://pear.php.net/Archive_Tar-1.4.7

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in PEAR/PackageFile/v1.php on line 1424
PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /usr/share/php/PEAR/PackageFile/v1.php on line 1424
upgrade-all ok: channel://pear.php.net/PEAR-1.10.9
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"

@raspberrypi:~ $ sudo pear list
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.4.7 stable
Console_Getopt 1.4.2 stable
PEAR 1.10.9 stable
PEAR_Manpages 1.10.0 stable
Structures_Graph 1.1.1 stable
XML_Util 1.4.3 stable
miki@raspberrypi:~ $

miki@raspberrypi:~ $ php -v
PHP 7.3.4-2 (cli) (built: Apr 13 2019 19:05:48) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.4-2, Copyright (c) 1999-2018, by Zend Technologies

@raspberrypi:~ $ sudo pear install DB
WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"
downloading DB-1.9.3.tgz ...
Starting to download DB-1.9.3.tgz (132,290 bytes)
.............................done: 132,290 bytes
install ok: channel://pear.php.net/DB-1.9.3

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA