2018/5/31

opencv library build from source.

opencv 的 install instruction 很隱晦。
到 document 去 search install,然後選 install_Linux 部份...
tutorial_linux_install

以下照做..
..git clone, cmake, make, make install.. 過然就 OK 了.
-- 為了避免跟 distribution 安裝的opencv library 衝突,所以改INSTALL_PATH 到 ~/opencvlib 下。

source code 的 samples/cpp/example_cmake 下有一個 Makefile 可以作為 build app 的標準 Makefile
CXX ?= g++

CXXFLAGS += -c -Wall $(shell pkg-config --cflags opencv)
LDFLAGS += $(shell pkg-config --libs --static opencv)

all: opencv_example

opencv_example: example.o; $(CXX) $< -o $@ $(LDFLAGS)

%.o: %.cpp; $(CXX) $< -o $@ $(CXXFLAGS)

clean: ; rm -f example.o opencv_example
build Z 的 sample 結果出現 xfeature2d.hpp 找不到,這是在 opencv_contrib 裡...
所以,git clone https://github.com/opencv/opencv_contrib.git

build contrib module 的 option 有在說明的後面...
重新安排一次..
mkdir opencv && cd opencv
git clone https://github.com/opencv/opencv
git clone https://github.com/opencv/opencv_contrib
create 安裝的 folder:
mkdir opencvlib
cd opencv
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=release -D CMAKE_INSTALL_PREFIX=/home/charles-chang/opencv/opencvlib -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules/ ..

另外,如果是gcc 6.X 配上 opencv3.1.0,還要加上 -DENABLE_PRECOMPILED_HEADERS=OFF 這個 option,否則會出現 stdlib.h not found 的 error。(ref)
還要配上hdf5.h not found 增加定義..
這樣 make OK,但是 build 自己的 code 的時候,會出現 libippicv 找步道,就要照這一篇,再增加定義....
最後,cmake 的 command option 是...
cmake -D CMAKE_BUILD_TYPE=release -D CMAKE_INSTALL_PREFIX=/home/charles-chang/opencv/lib3.1.0 -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules/ -D ENABLE_PRECOMPILED_HEADERS=OFF -D WITH_IPP=ON -D INSTALL_CREATE_DISTRIB=ON ..
這樣 build 出來的 opencv 已經可以正常 build application 了。
但是因為是 local install。所以執行 build 好的 application 時,會出現 so 找不到的錯誤。
就要設 LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/charles-chang/opencv/lib3.1.0/lib/
之後再 run 就 OK 了。


build opencv static library
build static library

2018/5/29

phabricator / Differential -- "Context not available." in diff view

在 review code時,只會顯示出 diff 的部份,原來會顯示 "full line" 的 option 的地方,只有出現 "Context not available."。

根據這一篇所說。
這是因為 windows 版 svn 不支援 -U99999 這個option 的關係。
所以解決方法就是用 gnu svn,然後寫一個 batch file 加上 -u9999 這個 option,取代原來得svn diff

2018/5/28

phabricator : working with svn

phabricator 跟 svn 工作的說明好像很少。
先照這一篇 試試看。
從 repository 開始...

一般會使用subversion 大概是因為舊專案。所以 repo 應該都是 monitor type。

新版只有 new repo 三種可以選, import 的 icon 結果是說明。
所以 new 一個 svn repo。
然後修改 uri,再 active 。
因為要做 monitor 用。所以 new uri,指向真正的 repo https://subversion.my.com/svn/AI/testproj/phabrisvn
選 observe。
出現 error,說有一個 uri 是 read/write,所以沒辦法設這個 uri 是 observe。
所以去外面把 原來那個自己生成的 uri disable。
然後設定這格 uri 的 Credential (這個是設定https://subversion.my.com/svn/AI/testproj/phabrisvn 的 username/password)。

因為 出現 error, 在 repo mananger 的 sync fail:
Error updating working copy: Command failed with error #1!
COMMAND
svn --non-interactive --no-auth-cache --trust-server-cert --username '********' --password '********' 
info --xml 'https://subversion.my.com/svn/AI/testproj/phabrisvn'

STDOUT




STDERR
svn: E170013: Unable to connect to a repository at URL 'https://subversion.my.com/svn/AI/testproj/phabrisvn'
svn: E230001: Server SSL certificate verification failed: certificate issued for a different hostname, issuer is not trusted
sudo su www-data -s /bin/bash
轉換身份 www-data 執行看看..
出現..
...
svn: E000002: Unable to open auth file for writing
svn: E000002: Can't create temporary file from template '/var/www/.subversion/auth/svn.ssl.server/svn-XXXXXX': No such file or directory

改 /var/www 的 owner 為 www-data,結果 su www-data 後 co OK。但是 phabricator update 還是 fail

依照說明,用
sudo /opt/phabricator/bin/repository update --trace R13
手動 update repo 'R13'。
結過還是錯。

所以用 root 來做..
sudo su - root 後, co 這個 svn repo,輸入 username/password, 並且接受 cert , server 後,
phabricator update 這格 error 消失,換出現另一個 error...

Error updating working copy: Repository "R13" does not have a correctly configured remote URI. 
The remote URI for a Subversion repository MUST point at the repository root. 
The root for this repository is "https://subversion.my.com/svn/AI", but 
the configured URI is "https://subversion.my.com/svn/AI/testproj/phabrisvn". 
To resolve this error, set the remote URI to point at the repository root. 
If you want to import only part of a Subversion repository, use the "Import Only" option.
遵照指示,在 manage repo 頁面,左邊有 subversion 這一個選項,這個選項可以輸入 目錄。
所以把 uri 改成 https://subversion.my.com/svn/AI,然後在這個 subversion 項目, 輸入 testproj/phabrisvn。
這樣 update 就沒問題了。


checkout and conduct a review

先 checkout svn repo
svn co https://subversion.my.com/svn/AI/testproj/phabrisvn
然後測試一下,arc diff..
$ arc diff
Usage Exception: This command requires arc to connect to a Phabricator install, but no
Phabricator installation is configured. To configure a Phabricator URI:

  - set a default location with `arc set-config default `; or
  - specify `--conduit-uri=uri` explicitly; or
  - run `arc` in a working copy with an '.arcconfig'.

第一次使用 arc,遵照這一篇,設定好 default phabricator server 位置
arc set-config default http://192.168.144.171
之後..arc diff 說,需要 run arc install-certificate ..
$ arc install-certificate
 CONNECT  Connecting to "http://192.168.144.171/api/"...
LOGIN TO PHABRICATOR
Open this page in your browser and login to Phabricator if necessary:

http://192.168.144.171/conduit/login/

Then paste the API Token on that page below.

    Paste API Token from that page: 
follow 這個 說明,開啟 頁面,會叫你 login,然後顯示你login user 對應的 API token 字串。
把那個字串 copy 到 command 的 ':' 後面..
接著出現:
Writing ~/.arcrc...
 SUCCESS!  API Token installed.
上面這兩個是寫在 ~/.arcrc 裡..
n$ cat ../.arcrc 
{
  "config": {
    "default": "http://192.168.144.171/"
  },
  "hosts": {
    "http://192.168.144.171/api/": {
      "token": "cli-txwsqp26sv3urka3t364xxxxxyhy"
    }
  }
}
OK,開始測試...參考這一頁subversion 的部份
修改檔案...
arc diff 提起 review ...會自動開啟 editor..
windows 10 的話,要先用..
arc set-config editor "C:\Program Files\Notepad++\notepad++.exe"
才會自動開啟 notepad++。
然後寫好 Reviewers, save退出。
reviewer 會收到通知。確認後。
arc list 列出目前狀態, OK 的話,就可以用..
arc commit 結束(commit 到 svn)


svn branch and merge

arc 沒有支援 subversion 的 branch/merge 動作。
所以都要自己做。
branch 就自己 svn cp. svn switch。
branch 也可以用 arc diff要求 review,只是 arc commit 是 commit 到 branch,main trunk 沒有影響。
merge 動作就要手動 svn merge XXOO。
然後 先用 arc diff 要求 review 後再 arc commit 把 merge 完的 code commit

2018/5/25

筆記: arcanist on windows 10

希望作到在 windows 10 上使用 arcanist + svn
ref: Arcanist User Guide:Windows

用git clone 的方式..
安裝 git
git for windows download and install git
然後只選 Use git from windows command prompt
不選 gui extension
Use OpenSSL library
Checkout Windows Style, commit Unix Style
Git bash terminal use MinTTY

裝完之後,開啟 cmd,輸入 git 已經可以找到command

安裝 php

ref:arcanist on windows 環境安裝
到 windows.php.net/download 下載 7.2 VC15 x64 non thread safe

unzip to C:\php

rename php.ini-development to php.ini
修改 php.ini,un-comment extension_dir,並且指向正確的地方:
externsion_dir="C:\php\ext"
還要打開 php_curl.dll 這個 extension,一樣,修改 php.ini。
在新版設定,變成 un-comment
extension=curl
設定 path..
用 find 找 "系統內容" 出來,進階 tab,最下面有 "環境變數"。新增一個 path: "C:\php\"。
設好開啟 cmd,輸入 php -i 看看有沒有東西...

安裝 arcanist

裝在 C:\phabri
C:\> md phabri
C:\> cd phabri
C:\phabri> git clone https://github.com/phacility/libphutil.git
C:\phabri> git clone https://github.com/phacility/arcanist.git
follow 剛剛的方法,在 path 加上 C:\phabri\arcanist\bin\

測試:開啟cmd.exe,輸入 arc help 有輸出東西..

subversion command line
裝 TortoiseSVN 1.10,安裝時記得要 check command line client tool


config arc

第一次用 arc提交 review 一定要先設定 uri, certifictaion, 和 editor。
arc set-config default uri http://xxoo
然後follow..
arc install-certification
的說明,把 api-key copy 過來。
最後再用
arc set-config editor "C:\Program Files\Nodepad++\nodepad++"
設定好 editor。

linux 會把 arcrc 放在 ~/ 下。
windows 10 我就不知到會放到哪裡。
所以要修改只有用 arc set-config 重設一次。
或用 arc get-config 來看。

2018/5/23

影像辨識 縮寫詞

其他:

原來車牌辨識有一個特定的名稱:ANPR (Automatic number plate recognition)。
google 起來有很多,像 這個 (openalpr) 就是一個放在 github 的實做。

2018/5/22

phabrictor : repo 操作

上一篇 已經把 phabricator 裝好了。
這裡做 phabricator 管 repo 的設定。一樣,是抄 rarguelloF 的 script

建立repo 要用的目錄,並且設定owner www-data
mkdir -p /var/repo
chown www-data:www-data /var/repo

mailadaptor 就安裝 sendmail
apt-get install sendmail
裝完沒有設什麼...



接著就是登入設定。第一個create 的 user 是 administrator,因為有限制最少password 字數,所以最後加上 123。
設定進入後...
上面的驚嘆號出現 15個...
  • Disable PHP always_populate_raw_post_data
  • Small MYSQL "max_allowed_packet"
  • MySQL_ONLY_FULL_GROUP_BY Mode Set
  • MySQL May Run Slowly
  • Server Timezone Not Configured
  • Alternate File Domain Not Configured
  • Install Pygment to Improve Syntax Hightlighting
  • Large File Storage Not Configured
  • PHP post_max_size Not Configured
  • OPcache Not Configured for Production
  • Base URI Not Configured
  • Not Authentication Providers Configured
  • Phabricator Daemon Are Not Running

貼一下 phabricator 自己的提示..
Disable PHP always_populate_raw_post_data

The "always_populate_raw_post_data" key is set to some value other than "-1" in your PHP configuration. 
This can cause PHP to raise deprecation warnings during process startup. Set this option to "-1" to prevent these warnings from appearing.
The current PHP configuration has this value:

always_populate_raw_post_data "0"
To update this value, edit your PHP configuration file, located here:

/etc/php/5.6/fpm/php.ini
You can find more information about PHP configuration values in the PHP Documentation.

After editing the PHP configuration, restart Phabricator for the changes to take effect. 
For help with restarting Phabricator, see Restarting Phabricator in the documentation.


PHP post_max_size Not Configured

Adjust post_max_size in your PHP configuration to at least 32MB. When set to smaller value, large file uploads may not work properly.
The current PHP configuration has this value:

post_max_size "8M"
To update this value, edit your PHP configuration file, located here:

/etc/php/5.6/fpm/php.ini
You can find more information about PHP configuration values in the PHP Documentation.

After editing the PHP configuration, restart Phabricator for the changes to take effect. 
For help with restarting Phabricator, see Restarting Phabricator in the documentation.


Small MySQL "max_allowed_packet"

On host "localhost", MySQL is configured with a small "max_allowed_packet" (16777216), 
which may cause some large writes to fail. The recommended minimum value for this setting is "33554432".
The current MySQL configuration has this value:

max_allowed_packet "16777216"
If you are using Amazon RDS, some of the instructions above may not apply to you. See User Guide: Amazon RDS for discussion of Amazon RDS.
這格要修改/etc/mysql/mysql.conf.d/mysqld.cnf

Install Pygments to Improve Syntax Highlighting

Phabricator can highlight a few languages by default, but installing and enabling Pygments (a third-party highlighting tool) 
will add syntax highlighting for many more languages. 

For instructions on installing and enabling Pygments, see the pygments.enabled configuration option.

If you do not want to install Pygments, you can ignore this issue.
The current Phabricator configuration has this value:

pygments.enabled false


就...installl..
apt-get install python-pygments
裝完以後,可以看看/設定 phabricator 的設置:
~$ sudo /opt/phabricator/bin/config get pygments.enabled
[sudo] password for charles-chang: 
{
  "config": [
    {
      "key": "pygments.enabled",
      "source": "local",
      "value": null,
      "status": "unset",
      "errorInfo": null
    },
    {
      "key": "pygments.enabled",
      "source": "database",
      "value": null,
      "status": "unset",
      "errorInfo": null
    }
  ]
}

也可以用 phabricator 的 web interface 設定: Config -- Config -- Syntax Highlighting -- pygments.enabled

2018/5/21

rarguelloF 的 phabricator install script 說明

沒寫過一次完整的,這次試試..
-- 是用 virtualbox , ubuntu 16.04 LTS server 版測試的。

這一篇: install intruction for phabricator in ubuntu 16.04 LTS

apt-get install git nginx mysql
and set mysql root password

接著..
add-apt-repository ppa:ondrej/php

 Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.

Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa

You can get more information about the packages at https://deb.sury.org

BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting

CAVEATS:
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
2. If you are using apache2, you are advised to add ppa:ondrej/apache2
3. If you are using nginx, you are advise to add ppa:ondrej/nginx-mainline
   or ppa:ondrej/nginx

PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/

WARNING: add-apt-repository is broken with non-UTF-8 locales, see 
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:

# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
 More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Press [ENTER] to continue or ctrl-c to cancel adding it

--- ENTER

gpg: keyring `/tmp/tmp6tm792u4/secring.gpg' created
gpg: keyring `/tmp/tmp6tm792u4/pubring.gpg' created
gpg: requesting key E5267A6C from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp6tm792u4/trustdb.gpg: trustdb created
gpg: key E5267A6C: public key "Launchpad PPA for Ondřej Surý" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK

然後再 apt-get update 一次。 就可以裝 php5.6..
apt-get install php5.6 php5.6-fpm php5.6-mbstring php5.6-common php5.6-mysql php5.6-curl php5.6-json php5.6-gd php-apcu php-pear

指定php 使用 php5.6
update-alternatives --set "php" /usr/bin/php5.6

安裝 phabricator (就是 clone git...)
安裝到 /opt
cd /opt
it clone https://github.com/phacility/libphutil.git
git clone https://github.com/phacility/arcanist.
git clone https://github.com/phacility/phabricator.git
然後change ower to nginx (www-data)

設置Nginx

新曾一個 site config file: /etc/nginx/site-available/phabricator
server {
  #server_name phabricator.example.com;
  root        /opt/phabricator/webroot;

  location / {
    index index.php;
    rewrite ^/(.*)$ /index.php?__path__=/$1 last;
  }

  location /index.php {
    fastcgi_pass   localhost:9000;
    fastcgi_index   index.php;

    #required if PHP was built with --enable-force-cgi-redirect
    fastcgi_param  REDIRECT_STATUS    200;

    #variables to make the $_SERVER populate in PHP
    fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param  QUERY_STRING       $query_string;
    fastcgi_param  REQUEST_METHOD     $request_method;
    fastcgi_param  CONTENT_TYPE       $content_type;
    fastcgi_param  CONTENT_LENGTH     $content_length;

    fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;

    fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
    fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

    fastcgi_param  REMOTE_ADDR        $remote_addr;
  }
}
server_name 改成這個 vm 的 ip..或是不要寫
-- nginx 設定的 server_name 是virtualhost 用的,參考 Nginx Virtual Host 設定教學
nginx 會依照 server_name 決定使用site-enabled/ 下的那一個 server config 檔,而不是單純依照 ip address
所以在lan 內沒有適當 dns,必須要用 ip 來服務,或是用 vm nat 測試,必須要經由 port forwarding 提供服務 (ip address 會變)。name_server舊部要寫

然後建立 site-enable/default 的 link 好啟動他..
ln -sf /etc/nginx/sites-available/phabricator /etc/nginx/sites-enabled/phabricator
一樣的名子就可以,不必用 "default",因為 nginx 是看所有sites-enabled/ 下的檔案,比照其中的 server_name..

增加一個 file : /etc/php/5.6/fpm/poo.d/phabricator.conf,同時把原來的 www.conf :
; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
[phabricator]

; Per pool prefix
; It only applies on the following directives:
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'
; When not set, the global prefix (or /usr) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool

; The address on which to accept FastCGI requests.
; Valid syntaxes are:
;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific address on
;                            a specific port;
;   'port'                 - to listen on a TCP socket to all addresses on a
;                            specific port;
;   '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000

; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
;listen.backlog = -1

; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
listen.allowed_clients = 127.0.0.1

; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
;                 mode is set to 0666
; listen.owner = www-data
; listen.group = www-data
; listen.mode = 0600

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
user = www-data
group = www-data

; Choose how the process manager will control the number of child processes.
; Possible Values:
;   static  - a fixed number (pm.max_children) of child processes;
;   dynamic - the number of child processes are set dynamically based on the
;             following directives:
;             pm.max_children      - the maximum number of children that can
;                                    be alive at the same time.
;             pm.start_servers     - the number of children created on startup.
;             pm.min_spare_servers - the minimum number of children in 'idle'
;                                    state (waiting to process). If the number
;                                    of 'idle' processes is less than this
;                                    number then some children will be created.
;             pm.max_spare_servers - the maximum number of children in 'idle'
;                                    state (waiting to process). If the number
;                                    of 'idle' processes is greater than this
;                                    number then some children will be killed.
; Note: This value is mandatory.
pm = dynamic

; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes to be created when pm is set to 'dynamic'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI.
; Note: Used when pm is set to either 'static' or 'dynamic'
; Note: This value is mandatory.
pm.max_children = 6

; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 3

; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 3

; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 5

; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
pm.max_requests = 500

; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. By default, the status page shows the following
; information:
;   accepted conn        - the number of request accepted by the pool;
;   pool                 - the name of the pool;
;   process manager      - static or dynamic;
;   idle processes       - the number of idle processes;
;   active processes     - the number of active processes;
;   total processes      - the number of idle + active processes.
;   max children reached - number of times, the process limit has been reached,
;                          when pm tries to start more children (works only for
;                          pm 'dynamic')
; The values of 'idle processes', 'active processes' and 'total processes' are
; updated each second. The value of 'accepted conn' is updated in real time.
; Example output:
;   accepted conn:        12073
;   pool:                 www
;   process manager:      static
;   idle processes:       35
;   active processes:     65
;   total processes:      100
;   max children reached: 1
; By default the status page output is formatted as text/plain. Passing either
; 'html' or 'json' as a query string will return the corresponding output
; syntax. Example:
;   http://www.foo.bar/status
;   http://www.foo.bar/status?json
;   http://www.foo.bar/status?html
; Note: The value must start with a leading slash (/). The value can be
;       anything, but it may not be a good idea to use the .php extension or it
;       may conflict with a real PHP file.
; Default Value: not set
pm.status_path = /fpm-status-zwei

; The ping URI to call the monitoring page of FPM. If this value is not set, no
; URI will be recognized as a ping page. This could be used to test from outside
; that FPM is alive and responding, or to
; - create a graph of FPM availability (rrd or such);
; - remove a server from a group if it is not responding (load balancing);
; - trigger alerts for the operating team (24/7).
; Note: The value must start with a leading slash (/). The value can be
;       anything, but it may not be a good idea to use the .php extension or it
;       may conflict with a real PHP file.
; Default Value: not set
ping.path = /ping-zwei

; This directive may be used to customize the response of a ping request. The
; response is formatted as text/plain with a 200 response code.
; Default Value: pong
;ping.response = pong

; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
request_terminate_timeout = 120s

; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
request_slowlog_timeout = 5s

; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
slowlog = /var/log/$pool.log.slow

; Set open file descriptor rlimit.
; Default Value: system defined value
rlimit_files = 4096

; Set max core size rlimit.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
rlimit_core = 0

; Chroot to this directory at the start. This value must be defined as an
; absolute path. When this value is not set, chroot is not used.
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
; of its subdirectories. If the pool prefix is not set, the global prefix
; will be used instead.
; Note: chrooting is a great security feature and should be used whenever
;       possible. However, all PHP paths will be relative to the chroot
;       (error_log, sessions.save_path, ...).
; Default Value: not set
;chroot =

; Chdir to this directory at the start.
; Note: relative path can be used.
; Default Value: current directory or / when chroot
chdir = /var/opt

; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
; Note: on highloaded environement, this can cause some delay in the page
; process time (several ms).
; Default Value: no
catch_workers_output = yes

; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
; the current environment.
; Default Value: clean env
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp

; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
;   php_value/php_flag             - you can set classic ini defines which can
;                                    be overwritten from PHP call 'ini_set'.
;   php_admin_value/php_admin_flag - these directives won't be overwritten by
;                                     PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.

; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.

; Note: path INI options can be relative and will be expanded with the prefix
; (pool, global or /usr)

; Default Value: nothing is defined by default except the values in php.ini and
;                specified at startup with the -d argument
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M

--- 這部份不清楚,不知道 fpm 怎麼處理 pool.d...

MySQL
設定 mysql root acccount and password,給予權限都
user/password: phabri/phabripass
$mysql -u root -p
ENTER password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.22-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE USER 'phabri'@'localhost' IDENTIFIED BY 'phabripass';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'phabri'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql>\q

設定 phabricator 中的 mysql 資訊

就是告知 phabricator 剛剛設定有關 mysql 的 user/password 資訊。讓 phabricator 可以正確操作 mysql
cd /opt/phabricator
sudo ./bin/config set mysql.host localhost
sudo ./bin/config set mysql.user phabri
sudo ./bin/config set mysql.pass phabripass
sudo ./bin/storage upgrade --force
...
...
有問題的話,可以用
\$ sudo ./bin/config get mysql.pass
{
  "config": [
    {
      "key": "mysql.pass",
      "source": "local",
      "value": "phabripass",
      "status": "set",
      "errorInfo": null
    },
    {
      "key": "mysql.pass",
      "source": "database",
      "value": null,
      "status": "unset",
      "errorInfo": null
    }
  ]
}
查一下有沒有設對。
最後 storage upgrade 是建立 mysql database

作到這裡之後,就可以用 browser 看一下...會出現phabricator首次服務的登入畫面..

2018/5/8

reset virtualbox vm root password

就跟一般的機器一樣。
用 sysrescue CD 開機。
把 virtualbox 的 root partition mount 進來到 /hd。
這個 vm 是 centos5,root partition 是 /dev/mapper/VolGroup00-LogVol00
chroot 到 root partition ..
chroot /hd /bin/bash
這樣就可以用 passwd 設定新 root password 了。

設完poweroff,再將 VM 開機,root password 就改成 新的了。