PHPのミラーからファイルがダウンロード出来ない!?
PHPのバージョンをあげようとwgetコマンドを叩いてphp.netからソースを落としてこようとした際
「mirror」というファイルがダウンロードされました。
こんな感じ
# wget http://jp1.php.net/get/php-5.4.32.tar.gz/from/this/mirror
--2014-08-26 15:09:24-- http://jp1.php.net/get/php-5.4.32.tar.gz/from/this/mirror
Resolving jp1.php.net... 54.248.253.251
Connecting to jp1.php.net|54.248.253.251|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://jp1.php.net/distributions/php-5.4.32.tar.gz [following]
--2014-08-26 15:09:24-- http://jp1.php.net/distributions/php-5.4.32.tar.gz
Connecting to jp1.php.net|54.248.253.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15323862 (15M) [application/x-gzip]
Saving to: “mirror”
100%[=======================================================================================================================================================>] 15,323,862 11.0M/s in 1.3s
2014-08-26 15:09:26 (11.0 MB/s) - “mirror” saved [15323862/15323862]
wgetのマニュアルを見てみるとこんな記述が..
# wget --help
--省略−−
--trust-server-names use the name specified by the redirection url last component.
--省略−−
「--trust-server-names」オプションを付けてやることで、リダイレクト先のファイルをダウンロードできるようになるっぽい。
やってみよう・・
# wget --trust-server-names http://jp1.php.net/get/php-5.4.32.tar.gz/from/this/mirror
--2014-08-26 15:23:33-- http://jp1.php.net/get/php-5.4.32.tar.gz/from/this/mirror
Resolving jp1.php.net... 54.248.253.251
Connecting to jp1.php.net|54.248.253.251|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://jp1.php.net/distributions/php-5.4.32.tar.gz [following]
--2014-08-26 15:23:33-- http://jp1.php.net/distributions/php-5.4.32.tar.gz
Connecting to jp1.php.net|54.248.253.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15323862 (15M) [application/x-gzip]
Saving to: “php-5.4.32.tar.gz”
100%[=======================================================================================================================================================>] 15,323,862 10.4M/s in 1.4s
2014-08-26 15:23:35 (10.4 MB/s) - “php-5.4.32.tar.gz” saved [15323862/15323862]
できた!
ファイル一個落とすのがしちめんどくさくなったがまあいいか。