{"id":2823,"date":"2021-02-04T23:21:30","date_gmt":"2021-02-04T14:21:30","guid":{"rendered":"https:\/\/www.beeete2.com\/blog\/?p=2823"},"modified":"2021-02-04T23:21:30","modified_gmt":"2021-02-04T14:21:30","slug":"wsl2%e4%b8%8a%e3%81%aeubuntu-20-04%e3%81%abphpenv%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b%e6%89%8b%e9%a0%86","status":"publish","type":"post","link":"https:\/\/www.beeete2.com\/blog\/?p=2823","title":{"rendered":"WSL2\u4e0a\u306eUbuntu 20.04\u306bphpenv\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u624b\u9806"},"content":{"rendered":"<p>\u7d043\u5e74\u3076\u308a\u306bLaravel\u306e\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u306e\u3067PHP\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u884c\u3046\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<br \/>\nyum\u7b49\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3068\u8907\u6570\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u5171\u5b58\u304c\u9762\u5012\u306a\u8a18\u61b6\u304c\u3042\u3063\u305f\u306e\u3067\u30bd\u30fc\u30b9\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<br \/>\npyenv\u7b49\u3067\u8907\u6570\u306ePython\u74b0\u5883\u3092\u5171\u5b58\u3055\u305b\u308b\u3053\u3068\u304c\u3059\u3054\u3044\u52b9\u7387\u304c\u3088\u304b\u3063\u305f\u306e\u3067PHP\u7248\u3082\u3042\u308b\u304b\u306a\u3068\u601d\u3063\u3066\u63a2\u3057\u305f\u3068\u3053\u308dphpenv\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002<br \/>\n\u6700\u8fd1\u30ec\u30dd\u30b8\u30c8\u30ea\u306e\u66f4\u65b0\u304c\u3042\u307e\u308a\u306a\u3044\u306e\u3067\u3001\u3082\u3057\u304b\u3057\u305f\u3089\u4e3b\u6d41\u3067\u306f\u306a\u3044\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u307b\u304b\u3092\u63a2\u3057\u3066\u3044\u308b\u6642\u9593\u3082\u3042\u307e\u308a\u306a\u304b\u3063\u305f\u306e\u3067phpenv\u3092\u4f7f\u3046\u3053\u3068\u306b\u3057\u305f\u306e\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u624b\u9806\u3092\u6b8b\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-bash\">\n# PHP\u306e\u30d3\u30eb\u30c9\u306b\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\nsudo apt -y install build-essential\nsudo apt -y install libxml2-dev libssl-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng-dev libmcrypt-dev libreadline-dev libtidy-dev libxslt-dev libzip-dev autoconf pkg-config\n\n# phpenv\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\ngit clone git:\/\/github.com\/phpenv\/phpenv.git ~\/.phpenv\n\n# zshrc\u306b\u30d1\u30b9\u8a2d\u5b9a\u3092\u3059\u308b\uff08bash\u3067\u3082\u540c\u69d8\u306e\u624b\u9806\u3060\u3068\u601d\u308f\u308c\u307e\u3059\u3002\uff09\necho 'export PATH=\"$HOME\/.phpenv\/bin:$PATH\"' &gt;&gt; ~\/.zshrc\necho 'eval \"$(phpenv init -)\"' &gt;&gt; ~\/.zshrc\nexec $SHELL -l\n\n# phpenv\u304c\u6b63\u3057\u304f\u5b9f\u884c\u3067\u304d\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3059\u308b\u3001\u6b63\u3057\u304f\u5b9f\u884c\u3067\u304d\u308c\u3070phpenv\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30d1\u30b9\u304c\u8868\u793a\u3055\u308c\u308b\nphpenv root\n\n# php\u3092\u30d3\u30eb\u30c9\u3059\u308b\u305f\u3081\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\ngit clone https:\/\/github.com\/php-build\/php-build $(phpenv root)\/plugins\/php-build\n\n# \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u308bPHP\u306e\u4e00\u89a7\u3092\u8868\u793a\u3059\u308b\u3001\u4eca\u56de\u306f7.3\u7cfb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\nphpenv install -l | grep 7.3\n\n# php\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u30b0\u30ed\u30fc\u30d0\u30eb\u306b\u8a2d\u5b9a\u3059\u308b\nphpenv install 7.3.26\nphpenv rehash\nphpenv global 7.3.26\n\n# \u6b63\u3057\u304f\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3059\u308b\nphp -v # PHP 7.3.26\n<\/code><\/pre>\n<p>\u3068\u3044\u3046\u611f\u3058\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u958b\u767a\u76ee\u7684\u3060\u3068Laravel\u306f\u30d3\u30eb\u30c9\u30a4\u30f3\u30b5\u30fc\u30d0\u30fc\u3067\u8d77\u52d5\u3059\u308b\u3053\u3068\u3082\u591a\u3044\u306e\u3067\u3001php\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3054\u3068\u306b\u5909\u66f4\u3067\u304d\u305f\u307b\u3046\u304c\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<h2>\u53c2\u8003\u30da\u30fc\u30b8<\/h2>\n<p><a href=\"https:\/\/qiita.com\/ryo-endo\/items\/0e689e02cb87e09f4c7a\" target=\"_blank\" rel=\"noopener\">Ubuntu 18.04 LTS \u306b phpenv\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057php\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5207\u308a\u66ff\u3048\u308b<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7d043\u5e74\u3076\u308a\u306bLaravel\u306e\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u306e\u3067PHP\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u884c\u3046\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002 yum\u7b49\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3068\u8907\u6570\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u5171\u5b58\u304c\u9762\u5012\u306a\u8a18\u61b6\u304c\u3042\u3063\u305f\u306e\u3067\u30bd &#8230; <\/p>\n","protected":false},"author":1,"featured_media":1366,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"views":4111,"_links":{"self":[{"href":"https:\/\/www.beeete2.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2823"}],"collection":[{"href":"https:\/\/www.beeete2.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.beeete2.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.beeete2.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.beeete2.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2823"}],"version-history":[{"count":6,"href":"https:\/\/www.beeete2.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2823\/revisions"}],"predecessor-version":[{"id":2831,"href":"https:\/\/www.beeete2.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2823\/revisions\/2831"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.beeete2.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/1366"}],"wp:attachment":[{"href":"https:\/\/www.beeete2.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.beeete2.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.beeete2.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}