Upgrade to Pro — share decks privately, control downloads, hide ads and more …

phpenvやめました🤦‍♂️

 phpenvやめました🤦‍♂️

「PHPerの今とその先を語り合うフォーラム2021」PHP TechCafeのLT資料です。
https://rakus.connpass.com/event/217189/

8e844e43f029ec38e206a464cf4587b3?s=128

Takashi Kanemoto

July 28, 2021
Tweet

Transcript

  1. /16 2021/07/28 #PHPTechCafe @ttskch 1 phpenv΍Ί·ͨ͠🤦

  2. /16 • ϦεςΟϯά޿ࠂͷձࣾͰWebαʔϏεΛ࡞ͬͯ·ͨ͠ • CTOͱͯ͠ࡏ੶ͨ͠8೥ؒͰɺࣾһ਺2໊ˠ60໊ɺ 
 ച্ن໛5000ສԁˠ27ԯԁʹ·Ͱ੒௕ 💪 💪 💪

    • ຊΛॻ͍ͨΓSchooͰߨٛͨ͠Γͱ͍ͬͨ׆ಈ΋ 2 ͖ͨͭͪ ʙ2020/03 (ג)ΧϧςοτίϛϡχέʔγϣϯζCTO 📝 blog.ttskch.com/thank-you-quartet-communications @ttskch
  3. /16 • डୗ։ൃͱࣾ֎CTO/ٕज़ސ໰ۀத৺Ͱ׆ಈͯ͠·͢ • Symfony͕େ޷͖Ͱ͢ ✨ • ڈ೥͸ΞυϕϯτΧϨϯμʔΛ1ਓͰ15೔ॻ͍ͨΓ 
 10ສจࣈͷిࢠॻ੶Λແྉެ։ͨ͠Γ͠·ͨ͠💪💪💪

    3 ͖ͨͭͪ 2020/04ʙ ϑϦʔϥϯεWebΤϯδχΞ 👨💻 kannade.jp @ttskch
  4. /16 2021/07/28 #PHPTechCafe @ttskch 4 phpenv΍Ί·ͨ͠🤦

  5. /28 $ phpenv install 8.0.0 [Success]: Built 8.0.0 successfully. 5

    phpenvͱ͸
  6. /28 $ PKG_CONFIG_PATH="/usr/local/opt/krb5/lib/pkgconfig:/usr/local/ opt/openssl/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig:/usr/ local/opt/libedit/lib/pkgconfig:/usr/local/opt/libxml2/lib/ pkgconfig" \ PHP_BUILD_CONFIGURE_OPTS="--with-zlib-dir=/usr/local/opt/zlib -- with-bz2=/usr/local/opt/bzip2

    --with-iconv=/usr/local/opt/libiconv --with-curl=/usr/local/opt/curl --with-libedit=/usr/local/opt/ libedit --with-jpeg-dir=/usr/local/opt/libjpeg —with-png-dir=/usr/ local/opt/libpng --with-external-gd=/usr/local/opt/gd" \ phpenv install 8.0.0 [Success]: Built 8.0.0 successfully. 6 ࠷ۙͷMacʹ͓͚Δݱ࣮ ࢀߟɿhttps://blog.ttskch.com/mac-phpenv-php-build/
  7. /16 7 ৄ͘͠͸ͪ͜Β https://speakerdeck.com/ttskch/phpenv-on-mac-nan-sisugiwarota

  8. /xxx 8 ͰɺͳΜ΍͔Μ΍͋ͬͯ

  9. /16 9 ݁ہphpenv΍Ί·ͨ͠ https://twitter.com/ttskch/status/1406141047063801856

  10. /16 • PHPͷϏϧυ͸৭Μͳϛυϧ΢ΣΞʹґଘ͍ͯͯ͠ɺԿ΋ͯ͠ͳ͍ͷʹյΕΔ ͜ͱ͕Α͋͘Δ্ʹτϥϒϧγϡʔτ͕େม͗͢Δ • ϏϧυΤϥʔΛղফ͠Α͏ͱඞਢͰάάͬͯͨΒ࠷ऴతʹ 
 Homebrew/homebrew-coreͷIssueͰ͢Ͱʹٞ࿦ࡁΈͩͬͨͷΛݟ͚ͭͯɺ 
 ࣗ෼͸ҰମԿΛ࠶ൃ໌͍ͯ͠ΔΜͩΖ͏͔ͱ͍͏ؾ࣋ͪʹͳΔ

    • Homebrewʹର͢ΔԼهͷΞυόϯςʔδ͸ଞͷखஈͰे෼୅ସͰ͖Δʢޙड़ʣ 1. ύονόʔδϣϯ୯ҐͰόʔδϣϯࢦఆͰ͖Δ 2. .php-version ͰσΟϨΫτϦ͝ͱʹPHPͷόʔδϣϯΛࢦఆͰ͖Δ 10 ΍Ίͨཧ༝
  11. /16 • ࣮ࡍͷͱ͜Ζɺύονόʔδϣϯ·Ͱࢦఆ͍ͨ͠έʔεͳΜͯ΄΅ͳ͍🤦 • ΋͋ͬͨ͠Βͦͷ͚࣌ͩDocker࢖͑͹͍͍͔ͳ 11 1. ύονόʔδϣϯ୯ҐͰόʔδϣϯࢦఆͰ͖Δʁ

  12. /16 12 2. σΟϨΫτϦ͝ͱʹPHPͷόʔδϣϯΛࢦఆͰ͖Δʁ • direnvͱ͍͏πʔϧͰ΄΅ಉ͜͡ͱͰ͖Δ👌 • .envrc ͱ͍͏ϑΝΠϧʹ؀ڥม਺Λఆ͓ٛͯ͘͠ͱɺͦͷσΟϨΫτϦʹ Ҡಈͨ͠ͱ͖ʹࣗಈͰ؀ڥม਺ΛಡΈࠐΜͰ͘ΕΔπʔϧ

    • https://github.com/direnv/direnv
  13. /28 # Πϯετʔϧ $ brew install direnvʊ $ echo 'eval

    "$(direnv hook zsh)"' >> ~/.zshrcʊ # σΟϨΫτϦ͝ͱʹPHPͷύεΛࢦఆ $ cd /path/to/projectʊ $ echo 'export PATH="/usr/local/opt/php@7.4/bin:$PATH"' > .envrcʊ $ direnv allow . 13 direnv
  14. /16 14 ͪͳΈʹextension͸ • PECLͰΠϯετʔϧͯ͠ php.ini ʹ௥هɺͰ؆୯ʹ௥ՃͰ͖Δ # PECLͷ࣮ߦʹඞཁͳϛυϧ΢ΣΞΛΠϯετʔϧ $

    brew install pkg-config zlibʊ # Πϯετʔϧͯ͠php.iniʹ௥ه $ pecl install apcuʊ $ echo 'extension=apcu.so' >> /usr/local/etc/php/7.4/php.ini ࢀߟɿhttps://grrr.tech/posts/installing-homebrew-php-extensions-with-pecl/
  15. /16 • phpenv on Mac͸೉͗͢͠Δ • Homebrewʹର͢ΔΞυόϯςʔδ͸ผͷπʔϧͳͲͰ୅ସՄೳ • ͜Ε͔Β͸ϏϧυͷͭΒΈΛ୅ΘΓʹ΍ͬͯ͘Ε͍ͯΔ͜ͱʹײँͭͭ͠ HomebrewͷPHPΛ࢖͍͖ͬͯ·͢😇

    15 ·ͱΊ
  16. /16 16 @ttskch ʘThanks!ʗ