言わずと知れたphpinfoのコマンド版
php -i
今回知りたかったロードしているモジュール一覧
php -m
phpの公式にコメント付きで書いてあるので、詳細はそちらで。
http://php.net/manual/ja/features.commandline.options.php
php -i
今回知りたかったロードしているモジュール一覧
php -m
selenium_hub:
image: docker.io/selenium/hub
container_name: selenium-hub
ports:
- 4444:4444
selenium_chrome:
image: docker.io/selenium/node-chrome-debug
container_name: selenium-chrome
ports:
- 49154:5900
links:
- selenium_hub:hub
selenium_firefox:
image: docker.io/selenium/node-firefox-debug
container_name: selenium-firefox
ports:
- 49155:5900
links:
- selenium_hub:hub
$ docker-compose up -d
こんな感じの状態になっていればOK$ docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------
selenium-chrome /opt/bin/entry_point.sh Up 0.0.0.0:49154->5900/tcp
selenium-firefox /opt/bin/entry_point.sh Up 0.0.0.0:49155->5900/tcp
selenium-hub /opt/bin/entry_point.sh Up 0.0.0.0:4444->4444/tcp
$ vi composer.json
{
"require": {
"phpunit/phpunit": "5.1.*",
"phpunit/phpunit-selenium": "dev-master",
"facebook/webdriver":"dev-master"
}
}
composerコマンドで、上記のパッケージをインストールする。
$ composer install
とりあえずFirefoxを立ち上げて、自分のブログのページを表示させてみるスクリプトを書く。
$ vi test.php
<?php
require_once 'vendor/autoload.php';
$host = 'http://VMのIP:4444/wd/hub';
$driver = RemoteWebDriver::create($host, DesiredCapabilities::firefox());
$driver->get('http://gyagya1111.blogspot.jp/');
で、実行する。
$ php test.php
VNCクライアントとかを使って、VMのIP:49155にアクセスすると、動いているのが見える。
composer install
composer.lockファイルを元にvendor配下にソースをインストールする。composer update
composer.jsonを元に最新のソースをインストールする。$ npm install -g yo generator-hubot coffee-script
すごい色々出てくるので略
インストール出来たか確認する。
$ npm list -g generator-hubot yo coffee-script
/home/vagrant/.nodebrew/node/v5.7.0/lib
├── coffee-script@1.10.0
├── generator-hubot@0.3.1
└── yo@1.6.0
こんな感じの一覧が出てくればインストールは完了。mkdir mybot && cd mybot
自分用のhubotを作成する。$ yo hubot
? ==========================================================================
We're constantly looking for ways to make yo better!
May we anonymously report usage statistics to improve the tool over time?
More info: https://github.com/yeoman/insight & http://yeoman.io
==========================================================================
→ yoの品質向上のために、使用統計や時間を匿名で報告するかもしれませんがいいですか?
Yes or No
? Owner (User )
→ 所有者は誰ですか?
自分の名前とかメールアドレスを書く
? Bot name (sanbot)
→ 作成するボットの名前
作成したディレクトリ名がデフォルトで入る様になっているので、変更する場合だけ入力する。
? Description (A simple helpful robot for your Company)
→ 概要説明
特にないので、空のままでEnter
? Bot adapter (campfire)
→ 作成したボットをどこで使うか
今回はslackを使うので、slackと入力する。
以上の項目を入力すると、ボットが作成される。$ yo hubot
? ==========================================================================
We're constantly looking for ways to make yo better!
May we anonymously report usage statistics to improve the tool over time?
More info: https://github.com/yeoman/insight & http://yeoman.io
========================================================================== Yes
_____________________________
/ \
//\ | Extracting input for |
////\ _____ | self-replication process |
//////\ /_____\ \ /
======= |[^_/\_]| /----------------------------
| | _|___@@__|__
+===+/ /// \_\
| |_\ /// HUBOT/\\
|___/\// / \\
\ / +---+
\____/ | |
| //| +===+
\// |xx|
? Owner XXXXXXXXXXXXXX@XXXXXXXX.com
? Bot name test-bot
? Description A simple helpful robot for your Company
? Bot adapter (campfire) slackgot back false
? Bot adapter slack
create bin/hubot
create bin/hubot.cmd
create Procfile
create README.md
create external-scripts.json
create hubot-scripts.json
create .gitignore
create package.json
create scripts/example.coffee
create .editorconfig
_____________________________
_____ / \
\ \ | Self-replication process |
| | _____ | complete... |
|__\\| /_____\ \ Good luck with that. /
|//+ |[^_/\_]| /----------------------------
| | _|___@@__|__
+===+/ /// \_\
| |_\ /// HUBOT/\\
|___/\// / \\
\ / +---+
\____/ | |
| //| +===+
\// |xx|
色々出てくるので略
最後の方にツリー構造みたいなのが出てくる。
エラーが出来なければインストール完了。
botを起動してみる。
$ bin/hubot -a shell -n sanbot
~ 略 ~
sanbot> [Wed Feb 24 2016 07:14:55 GMT+0000 (GMT)] ERROR hubot-heroku-alive included, but missing HUBOT_HEROKU_KEEPALIVE_URL. `heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s | grep web-url | cut -d= -f2)`
[Wed Feb 24 2016 07:14:55 GMT+0000 (GMT)] INFO hubot-redis-brain: Using default redis on localhost:6379
ここまで出たらEnterキーを押す。
そうすると、入力待ちの状態になるので、任意のコマンドを入力してみる。
sanbot> @sanbot ping
sanbot> PONG
ボットから返事が返って来たら完了!sanbot> exit
で終了出来ます。
$ curl -L git.io/nodebrew | perl - setup
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
100 23754 100 23754 0 0 6116 0 0:00:03 0:00:03 --:--:-- 6116
Fetching nodebrew...
Installed nodebrew in $HOME/.nodebrew
========================================
Export a path to nodebrew:
export PATH=$HOME/.nodebrew/current/bin:$PATH
========================================
で、カレントユーザーの.bash_profileに追加
$ vi ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
# for nodebrew ← この行を追加
PATH=$PATH:$HOME/.nodebrew/current/bin ← この行を追加
export PATH
インストール可能なnode.jsのバージョンをチェック
$ nodebrew ls-remote
~ 略 ~
v5.0.0 v5.1.0 v5.1.1 v5.2.0 v5.3.0 v5.4.0 v5.4.1 v5.5.0
v5.6.0 v5.7.0
~ 略 ~
とりあえず5系の最新版をインストールする。(時間掛かる)
$ nodebrew install v5.7.0
インストール済みのnode.jsのバージョン一覧を確認する。
$ nodebrew list
v5.7.0
current: none
5.7がインストールされた事を確認出来たので、現在使用するnode.jsのバージョンを指定する。
$ nodebrew use v5.7.0
もう一回nodebrewコマンドでバージョン確認
$ nodebrew list
v5.7.0
current: v5.7.0
currentにインストールしたバージョンが出てくる様になった事を確認して、下記コマンドでnode.jsのバージョンを確認
$ node -v
v5.7.0
これでnode.jsを使える様になった。
wget -O- https://toolbelt.heroku.com/install.sh | sh
--2015-12-29 18:33:34-- https://toolbelt.heroku.com/install.sh
toolbelt.heroku.com をDNSに問いあわせています... 54.225.72.13, 54.235.97.119, 54.235.222.159
toolbelt.heroku.com|54.225.72.13|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 975 [text/plain]
`STDOUT' に保存中
0% [ ] 0 --.-K/s This script requires superuser access to install software.
You will be prompted for your password by sudo.
100%[==========================================================================================================================================>] 975 --.-K/s 時間 0s
2015-12-29 18:33:34 (38.1 MB/s) - stdout へ出力完了 [975/975]
Add the Heroku CLI to your PATH using:
$ echo 'PATH="/usr/local/heroku/bin:$PATH"' >> ~/.bash_profile
$ vi ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
PATH="$PATH:/usr/local/heroku/bin" ← この行を追加
export PATH
$ source ~/.bash_profile
$ which heroku
/usr/local/heroku/bin/heroku
$ ifconfig
docker0 Link encap:Ethernet HWaddr 16:60:95:11:A4:9C
inet addr:172.17.42.1 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::3807:43ff:fe23:6f0a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:834595 errors:0 dropped:0 overruns:0 frame:0
TX packets:2501 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:26940488 (25.6 MiB) TX bytes:647482 (632.3 KiB)
このdocker0の部分がdockerコンテナ上から見えるホストマシンのIPでした。watch iptables -xnvL
というコマンド。watch iptables -xnvL
Every 2.0s: iptables -xnvL Wed Feb 17 10:25:31 2016
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
19053 1507938 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
14 2264 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
24 1408 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
1012 84278 IN_LOGGING all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
見るべき点はpktsとbytes部分を特に注目してみる。REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
ACCEPT tcp -- anywhere anywhere tcp dpt:webcache
となっていたのですが、自分の認識だと上に書いた設定を下に書いた設定で上書き出来るんじゃなかったかなという朧気な記憶を元に記述したのですが、案の定間違っていました・・・。watch iptables -xnvL
Every 2.0s: iptables -xnvL Wed Feb 17 10:21:20 2016
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
19053 1507938 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
14 2264 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
0 94822 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
0 0 IN_LOGGING all -- * * 0.0.0.0/0 0.0.0.0/0
設定の上書きではなく、条件にマッチしなかったものが順次下に行くといった挙動でした・・・。php artisan clear-compiled php artisan optimize
$ composer update
Loading composer repositories with package information Updating dependencies (including require-dev)
Writing lock file
Generating autoload files
> php artisan clear-compiled
PHP Fatal error: Class 'MyAPP\Services\App\AppServiceProvider' not found in /home/user/site/myapp/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 157
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'MyAPP\\Services\\App\\AppServiceProvider' not found","file":"\/home\/user\/site\/myapp\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/ProviderRepository.php","line":157}}Script php artisan clear-compiled handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Fatal error: Class 'MyAPP\Services\App\AppServiceProvider' not found in /home/user/site/myapp/vendor/laravel/framework/src/Illuminate
/Foundation/ProviderRepository.php on line 157
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--] []...
一度、自分で作ったServiceProviderをコメントアウトして、php artisan dump-autoloadし、コメントアウトを外して再度php artisan dump-autoloadすると問題なく使用出来る様になる。/vendor/vendor_name/package_name/src/MyAPP/Service/XXXX/XXXXServiceProvider.php
"autoload": {
"psr-4": {
"MyAPP\\": "src/"
}
}
正しいcomposer.jsonの記述"autoload": {
"psr-4": {
"MyAPP\\": "src/MyAPP/"
}
}
このパスが間違っているせいでautoload_psr4.phpの中の処理で引っかからずに、$ vi vendor/composer/ClassLoader.php
〜略〜
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
if (0 === strpos($class, $prefix)) {
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
}
composer.jsonファイルを修正して、composer updateコマンドを打つ。
これでエラーが出なくなりました。