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/

Takashi Kanemoto

July 28, 2021
Tweet

More Decks by Takashi Kanemoto

Other Decks in Programming

Transcript

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

    View full-size slide

  2. /16
    • ϦεςΟϯά޿ࠂͷձࣾͰWebαʔϏεΛ࡞ͬͯ·ͨ͠


    • CTOͱͯ͠ࡏ੶ͨ͠8೥ؒͰɺࣾһ਺2໊ˠ60໊ɺ

    ച্ن໛5000ສԁˠ27ԯԁʹ·Ͱ੒௕ 💪 💪 💪


    • ຊΛॻ͍ͨΓSchooͰߨٛͨ͠Γͱ͍ͬͨ׆ಈ΋
    2
    ͖ͨͭͪ
    ʙ2020/03


    (ג)ΧϧςοτίϛϡχέʔγϣϯζCTO


    📝 blog.ttskch.com/thank-you-quartet-communications
    @ttskch

    View full-size slide

  3. /16
    • डୗ։ൃͱࣾ֎CTO/ٕज़ސ໰ۀத৺Ͱ׆ಈͯ͠·͢


    • Symfony͕େ޷͖Ͱ͢ ✨


    • ڈ೥͸ΞυϕϯτΧϨϯμʔΛ1ਓͰ15೔ॻ͍ͨΓ

    10ສจࣈͷిࢠॻ੶Λແྉެ։ͨ͠Γ͠·ͨ͠💪💪💪
    3
    ͖ͨͭͪ
    2020/04ʙ


    ϑϦʔϥϯεWebΤϯδχΞ


    👨💻 kannade.jp
    @ttskch

    View full-size slide

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

    View full-size slide

  5. /28
    $ phpenv install 8.0.0


    [Success]: Built 8.0.0 successfully.
    5
    phpenvͱ͸

    View full-size slide

  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/

    View full-size slide

  7. /16
    7
    ৄ͘͠͸ͪ͜Β
    https://speakerdeck.com/ttskch/phpenv-on-mac-nan-sisugiwarota

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  10. /16
    • PHPͷϏϧυ͸৭Μͳϛυϧ΢ΣΞʹґଘ͍ͯͯ͠ɺԿ΋ͯ͠ͳ͍ͷʹյΕΔ
    ͜ͱ͕Α͋͘Δ্ʹτϥϒϧγϡʔτ͕େม͗͢Δ


    • ϏϧυΤϥʔΛղফ͠Α͏ͱඞਢͰάάͬͯͨΒ࠷ऴతʹ

    Homebrew/homebrew-coreͷIssueͰ͢Ͱʹٞ࿦ࡁΈͩͬͨͷΛݟ͚ͭͯɺ

    ࣗ෼͸ҰମԿΛ࠶ൃ໌͍ͯ͠ΔΜͩΖ͏͔ͱ͍͏ؾ࣋ͪʹͳΔ


    • Homebrewʹର͢ΔԼهͷΞυόϯςʔδ͸ଞͷखஈͰे෼୅ସͰ͖Δʢޙड़ʣ


    1. ύονόʔδϣϯ୯ҐͰόʔδϣϯࢦఆͰ͖Δ


    2. .php-version ͰσΟϨΫτϦ͝ͱʹPHPͷόʔδϣϯΛࢦఆͰ͖Δ
    10
    ΍Ίͨཧ༝

    View full-size slide

  11. /16
    • ࣮ࡍͷͱ͜Ζɺύονόʔδϣϯ·Ͱࢦఆ͍ͨ͠έʔεͳΜͯ΄΅ͳ͍🤦


    • ΋͋ͬͨ͠Βͦͷ͚࣌ͩDocker࢖͑͹͍͍͔ͳ
    11
    1. ύονόʔδϣϯ୯ҐͰόʔδϣϯࢦఆͰ͖Δʁ

    View full-size slide

  12. /16
    12
    2. σΟϨΫτϦ͝ͱʹPHPͷόʔδϣϯΛࢦఆͰ͖Δʁ
    • direnvͱ͍͏πʔϧͰ΄΅ಉ͜͡ͱͰ͖Δ👌


    • .envrc ͱ͍͏ϑΝΠϧʹ؀ڥม਺Λఆ͓ٛͯ͘͠ͱɺͦͷσΟϨΫτϦʹ
    Ҡಈͨ͠ͱ͖ʹࣗಈͰ؀ڥม਺ΛಡΈࠐΜͰ͘ΕΔπʔϧ


    • https://github.com/direnv/direnv

    View full-size slide

  13. /28
    # Πϯετʔϧ


    $ brew install direnvʊ


    $ echo 'eval "$(direnv hook zsh)"' >> ~/.zshrcʊ


    # σΟϨΫτϦ͝ͱʹPHPͷύεΛࢦఆ


    $ cd /path/to/projectʊ


    $ echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"'


    > .envrcʊ


    $ direnv allow .
    13
    direnv

    View full-size slide

  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/

    View full-size slide

  15. /16
    • phpenv on Mac͸೉͗͢͠Δ


    • Homebrewʹର͢ΔΞυόϯςʔδ͸ผͷπʔϧͳͲͰ୅ସՄೳ


    • ͜Ε͔Β͸ϏϧυͷͭΒΈΛ୅ΘΓʹ΍ͬͯ͘Ε͍ͯΔ͜ͱʹײँͭͭ͠
    HomebrewͷPHPΛ࢖͍͖ͬͯ·͢😇
    15
    ·ͱΊ

    View full-size slide

  16. /16
    16
    @ttskch
    ʘThanks!ʗ

    View full-size slide