php7 ppa

出處: https://www.colinodell.com/blog/201711/installing-php-72

Ubuntu 14.04, 16.04, 17.04, 17.10, & 18.04

PHP 7.2 can be installed using Ondřej Surý’s PPA:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.2-cli

View the full list of available packages here.

Debian 8 (Jessie) and 9 (Stretch)

Ondřej Surý also provides PHP 7.2 packages for Debian which can be installed using these commands:

sudo apt-get install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt-get update
sudo apt-get install php7.2-cli

Debian 7 (Wheezy)

PHP 7.2 can be compiled from source by following the instructions outlined here: Install PHP 7 on Debian Wheezy. Make sure you git checkout the appropriate tag after cloning the php-src repository.

CentOS / RHEL 6+ & Fedora 25+

Remi Collet, one of the release managers for PHP 7.2, also publishes RPM packages for this new version. You can use the configuration wizard to determine the exact setup steps, or see Remi’s website for additional details about the 7.2.0 release.

Mac OS X

PHP 7.2 can easily be installed via Liip’s php-osx tool:

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2

Or, if you prefer using Homebrew:

brew tap homebrew/homebrew-php
brew install php72

Windows

PHP 7.2 distributions for Windows can be found on the windows.php.net website: http://windows.php.net/download#php-7.2

You can find instructions for installing the distribution here: https://www.webtechgadgetry.com/install-php-7-windows/

phpbrew

phpbrew is a really nice tool that helps you download, compile, and manage multiple versions of PHP. Assuming you’ve already followed the installation directions and have phpbrew up-and-running, PHP 7.2.0 can be installed with two easy commands:

phpbrew update
phpbrew install -j $(nproc) 7.2.0 +default

Docker

Official PHP images can be found on Docker Hub. You can use the php:7.2 tag for base images.

If you’d like to tinker with PHP 7.2 in an interactive shell, simply run this in your terminal:

docker run -it --rm php:7.2

細菌和燒杯

細菌每分鐘一分為二一次, 假如裝滿燒杯要花 60 分鐘, 那從午夜 11:00 開始分裂,
燒杯半滿是什麼時候?11:59 !

燒杯容量 = 2^60, 半滿兩邊除以二,
燒杯容量/2 = 2^60 / 2 = 2^59,
也就是 59 分時是半滿, 60 分 時就滿了

php aspect mock

最近在研究 aspect mock.
發現幾點要注意的:

  1. 文件有提到:
    appDir defines the root of web application which is being tested. All classes outside the root will be replaced with the proxies generated by AspectMock. By default it is a directory in which vendor dir of composer if located. If you don’t use Composer or you have custom path to composer’s vendor’s folder, you should specify appDir.
    意思是如果 你 include 要 mock 的 dir 不在 appDir  底下.
    那就不行.
  2. 如果你要 mock 的 class method 是繼承來的.
    class 本身沒有去 override parent method.
    那麼 parent class 也要在 include path 裡面.
  3. 由於 asspect mock 是利用蓋掉已經註冊進去 spl autoload 的 composer ClassLoader
    把它換成自己的, 所以像是 php 內建 Memcached 這種,
    他就沒轍了…

權利與自由

爭取你自己的權利就是爭取國家的權利; 爭取你自己的自由,就是爭取國家的自由; 一個自由民主國家,從來不是由一幫奴才建成的。 --胡適.

高雄空氣污染

搭飛機從花蓮到高雄,
起飛時真的是天氣晴朗,
萬里無雲,
看著鮮綠的花東縱谷,
心想回到高雄會看到林立的高樓,
彷彿鮮明對比,
不過到了高雄沒有看到高樓,
倒是起了霧,
等等…有冷到起霧嗎?
遲疑了一下,
突然恍然大悟,
原來是空氣污染…

複雜的ipv6設定

還蠻有趣的真的!
之前在台北有用過,
但是那時是用 ddwrt 內建的功能,
點一點就配置好了!
以下是以我前幾天申請了hinet ipv6來玩,
現在申請比以前簡單很多,
http://www.ipv6.hinet.net/,
有線上申請的連結!!
點一點就有了(而且幾乎是馬上),
手癢把之前改裝成 router 的 raspberry pi 2,
增加了 SLAAC 功能,
步驟如下:

1. 開啟 ipv6:
編輯 /etc/modules 加入一行 ipv6

2. /etc/ppp/options: 增加這行 +ipv6 ipv6cp-use-ipaddr

3. 裝完 wide-dhcpv6-client (安裝過程會問你要監聽哪個介面,記得改成 ppp0), 編輯 /etc/wide-dhcpv6/dhcp6c.conf


interface ppp0
{
send ia-pd 0;
script "/etc/wide-dhcpv6/dhcp6c-script";
};
id-assoc pd 0 {
prefix-interface eth0 {
sla-len 0;
};
};

這是要從 isp 那邊拿到配發的 prefix.

4. 裝完 radvd 編輯 /etc/radvd.conf (公告ra用的)

interface eth0
{
AdvSendAdvert on;
AdvManagedFlag off; //由ra取得prefix然後自己組合產生ipv6位址
AdvOtherConfigFlag on; //dns等其他資訊由 dhcpv6 拿
AdvLinkMTU 1492;
MinRtrAdvInterval 3;
MaxRtrAdvInterval 10;
prefix ::/64 {
AdvRouterAddr on;
AdvOnLink on;
AdvAutonomous on;
};
};

dns 部分本來我是設定 rdnss 不過 windows 沒支援…
mac os x 10.10 倒是有.

5. 裝完 wide-dhcpv6-server 編輯 /etc/wide-dhcpv6/dhcp6s.conf
option domain-name-servers 2001:b000:168::1 2001:b000:168::2 2001:4860:4860::8888 2001:4860:4860::8844;
option domain-name “xxx.org”;

第一個就是列出 dns 位址, 前兩組是 hinet 後面是 google的.
option domain-name, dns 尾碼, 設定之後, client 比如只打 www,
如果 dns 查不到,
為自動補完變成 www.xxx.org.

wide-dhcpv6-server 這個東西要不要配置其實無所謂,
因為其實hinet 他的 ipv4 dns 可以查得到反解成 ipv6 的位址,
所以就算沒有ipv6的 dns,
還是照常可以查詢,
我會知道是因為沒有設定 ipv6 dns,
nslookup 可以看到是到 ipv4 dns 查的.

6. 編輯 /etc/sysctl.conf
net.ipv6.conf.all.forwarding=1
net.ipv6.conf.default.forwarding=1
net.ipv6.conf.all.accept_ra=2
net.ipv6.conf.default.accept_ra=2

下面要設定 accept_ra 的原因是如果不這樣
ppp0 就拿不到 ip 了.

7. 編輯 /etc/ppp/ipv6-up 最後加入
service wide-dhcpv6-client start
service radvd start
service wide-dhcpv6-server start

配置完我是直接重開-_-!
然後就完成啦!!

看似輕鬆完成,
其實我研究了整整兩天= =!!
因為要看很多資料,
還要知道 hinet 怎配的…