Gehirn (ゲヒルン) RS2を使ってみたけどPharファイルが使えないと思ったら使えるようになった件
こちらの記事 22歳のセキュリティーコンサルタントが立ち上げたのはたった315円で利用できるインフラサービス で知った Gehirn RS2 というサーバレンタルサービス。
クラウド環境のレンタルサーバで、いわゆるPaaSになるんでしょうか?
独自ドメイン対応、複数SSHアカウント、複数FTPアカウント、cron利用可、PHP5.3、MySQL5.1、.htaccess利用可、月額315円で2週間お試し無料というコストパフォーマンスに釣られて、とりあえず試してみました。
まずGehirn IDを取得して、そのあとRS2アカウント登録、更にRS2のプラン契約を行う必要があります。
Gehirn IDの取得には電話番号の登録が、RS2のプラン契約には郵便番号や住所の登録が必要になります。
SSHやFTPアカウントの設定も、ブラウザの Gehirn Web Services ControlPanel から行い、すぐにSSHログイン可能です。
ちなみにシェルは Gehirn RS2 というzshベースの独自環境を提供していて、環境セットアップ用の rs2 コマンドが用意されています。
GehirnRS2 | ゲヒルンサービスサイト
まずはPHPのバージョンを確認します。
$ php -v PHP 5.3.3-7+squeeze14 with Suhosin-Patch (cli) (built: Aug 6 2012 14:18:06) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
Suhosinパッチ適用済みの5.3.3のようです。
5.4系ではないのは残念ですが、Silexは確か5.3.2以上でしたっけ…ぎりぎりクリアしてますね。
次に、使えるモジュールを確認してみます。
$ php -m [PHP Modules] apc bcmath bz2 calendar Core ctype curl date dba dom ereg exif fileinfo filter ftp gd gettext hash iconv imagick json libxml mbstring mcrypt mhash mysql mysqli openssl pcntl pcre PDO pdo_mysql pdo_sqlite Phar posix Reflection session shmop SimpleXML soap sockets SPL SQLite sqlite3 standard suhosin sysvmsg sysvsem sysvshm tokenizer uuid wddx xml xmlreader xmlwriter zip zlib [Zend Modules] Suhosin
ぱっと見かなり充実してます。これならとりあえず色々試せそうです。
次に、とりあえずpearコマンドでも試してみようと rs2 pear install してみました。
$ rs2 pear install …(中略)… Successfully created default configuration file "/home/kholy/.pearrc" WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update WARNING: "pear/Console_Getopt" is deprecated in favor of "pear/Console_GetoptPlus" downloading PEAR-1.9.4.tgz ... Starting to download PEAR-1.9.4.tgz (296,332 bytes) .............................................................done: 296,332 bytes downloading Archive_Tar-1.3.10.tgz ... Starting to download Archive_Tar-1.3.10.tgz (18,294 bytes) ...done: 18,294 bytes downloading Structures_Graph-1.0.4.tgz ... Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes) ...done: 30,318 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 XML_Util-1.2.1.tgz ... Starting to download XML_Util-1.2.1.tgz (17,729 bytes) ...done: 17,729 bytes install ok: channel://pear.php.net/Archive_Tar-1.3.10 install ok: channel://pear.php.net/Structures_Graph-1.0.4 install ok: channel://pear.php.net/Console_Getopt-1.3.1 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"
PEARの標準パッケージがインストールされました。
環境はこんな感じで設定されています。
$ pear config-show [17:36:02] 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 /home/kholy/pear PEAR documentation directory doc_dir /home/kholy/pear/docs PHP extension directory ext_dir /home/kholy/pear/ext PEAR directory php_dir /home/kholy/pear/php PEAR Installer cache directory cache_dir /home/kholy/pear/cache PEAR configuration file cfg_dir /home/kholy/pear/cfg directory PEAR data directory data_dir /home/kholy/pear/data PEAR Installer download download_dir /home/kholy/pear/download directory PHP CLI/CGI binary php_bin /usr/bin/php php.ini location php_ini <not set> --program-prefix passed to php_prefix <not set> PHP's ./configure --program-suffix passed to php_suffix <not set> PHP's ./configure PEAR Installer temp directory temp_dir /home/kholy/pear/temp PEAR test directory test_dir /home/kholy/pear/tests PEAR www files directory www_dir /home/kholy/pear/www Cache TimeToLive cache_ttl 3600 Preferred Package State preferred_state stable Unix file mask umask 22 Debug Log Level verbose 1 PEAR password (for password <not set> maintainers) Signature Handling Program sig_bin /usr/bin/gpg Signature Key Directory sig_keydir /etc/pear/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 /home/kholy/.pearrc System Configuration File Filename /etc/pear/pear.conf
とりあえずStagehand_TestRunnerを入れてみます。
$ pear config-set preferred_state beta $ pear config-set auto_discover 1 $ pear channel-discover pear.piece-framework.com $ pear install --alldeps piece/stagehand_testrunner …(中略)… install ok: channel://pear.symfony.com/ClassLoader-2.1.3 install ok: channel://pear.symfony.com/Config-2.1.3 install ok: channel://pear.symfony.com/Console-2.1.3 install ok: channel://pear.symfony.com/DependencyInjection-2.1.3 install ok: channel://pear.symfony.com/Finder-2.1.3 install ok: channel://pear.symfony.com/Process-2.1.3 install ok: channel://pear.symfony.com/Yaml-2.1.3 install ok: channel://pear.piece-framework.com/Stagehand_AlterationMonitor-2.0.1 install ok: channel://pear.piece-framework.com/Stagehand_ComponentFactory-1.0.1 install ok: channel://pear.piece-framework.com/Stagehand_TestRunner-3.3.1
pearコマンドでのインストールは問題なく行えるようです。
次に、composerを入れてSilexを使ってみようと思ったのですが…。
composer.pharを取得して…?
$ curl -s http://getcomposer.org/installer | php #!/usr/bin/env php Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again: The suhosin.executor.include.whitelist setting is incorrect. Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini): suhosin.executor.include.whitelist = phar The php.ini used by your command-line PHP is: /etc/php5/cli/php.ini
なんか怒られました。orz
php.ini か suhosin.ini に suhosin.executor.include.whitelist = phar が必要なようです?
どちらの設定ファイルもrootでしか編集できないので、残念ながらこれ以上は無理ですね。
一応、お問い合わせ窓口からお願いしてみました。
Composerが使えないことはPHPユーザーにとってかなりの損失になるということを、理解していただけるといいのですが…。
…って、書いてる矢先に対応していただいたようで、問い合わせへの返信が来ていました。
やったー!ありがとうございます!!
それではもう一度…。
$ curl -s http://getcomposer.org/installer | php #!/usr/bin/env php Some settings on your machine may cause stability issues with Composer. If you encounter issues, try to change the following: Your PHP (5.3.3-7+squeeze14) is quite old, upgrading to PHP 5.3.4 or higher is recommended. Composer works with 5.3.2+ for most people, but there might be edge case issues. The date.timezone setting should be provided. Add the following to the end of your `php.ini`: ; UTC here is an example, use your own timezone, see http://www.php.net/manual/en/timezones.php date.timezone = UTC The php.ini used by your command-line PHP is: /etc/php5/cli/php.ini Downloading... Composer successfully installed to: /home/kholy/composer.phar Use it: php composer.phar
よしよし、次にcomposer.jsonを書いて…
インストールするよ
$ php composer.phar install Loading composer repositories with package information Installing dependencies - Installing symfony/routing (dev-master 00001c0) Cloning 00001c0db3f4d95dd14db3c516bd4de51049f58e - Installing symfony/http-foundation (dev-master 61fd9b9) Cloning 61fd9b900ade7c330528767969d2798c031c558a - Installing symfony/event-dispatcher (dev-master 0f124bd) Cloning 0f124bd9475daca0a3eef3434e46c78f8fd767cd - Installing symfony/http-kernel (dev-master 0571e0d) Cloning 0571e0d0327a963a6494ef501d5aa4d954e3df92 - Installing pimple/pimple (dev-master 86df060) Cloning 86df0604a10c5faf20b466ae6a0b762cc6ed0a35 - Installing silex/silex (dev-master 960f097) Cloning 960f097be06f24d7d112deaa68fa904796435b85 symfony/routing suggests installing doctrine/common (>=2.2,<2.4-dev) symfony/routing suggests installing symfony/config (2.2.*) symfony/routing suggests installing symfony/yaml (2.2.*) symfony/event-dispatcher suggests installing symfony/dependency-injection (2.2.*) symfony/http-kernel suggests installing symfony/browser-kit (2.2.*) symfony/http-kernel suggests installing symfony/class-loader (2.2.*) symfony/http-kernel suggests installing symfony/config (2.2.*) symfony/http-kernel suggests installing symfony/console (2.2.*) symfony/http-kernel suggests installing symfony/dependency-injection (2.2.*) symfony/http-kernel suggests installing symfony/finder (2.2.*) silex/silex suggests installing symfony/browser-kit (>=2.1,<2.3-dev) silex/silex suggests installing symfony/css-selector (>=2.1,<2.3-dev) silex/silex suggests installing symfony/dom-crawler (>=2.1,<2.3-dev) Writing lock file Generating autoload files
よーしよし。
index.php
やったー動いたよー
ひとまず2週間、色々試してみようと思います。
[追記]
仮想rootっていうお砂場で好きに遊ばせてくれる系の機能があるみたいです。
Gehirn RS2「仮想root」について
これ使ったらPHP5.4も入るかな?