Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

/16 • ϦεςΟϯά޿ࠂͷձࣾͰWebαʔϏεΛ࡞ͬͯ·ͨ͠ • CTOͱͯ͠ࡏ੶ͨ͠8೥ؒͰɺࣾһ਺2໊ˠ60໊ɺ 
 ച্ن໛5000ສԁˠ27ԯԁʹ·Ͱ੒௕ 💪 💪 💪 • ຊΛॻ͍ͨΓSchooͰߨٛͨ͠Γͱ͍ͬͨ׆ಈ΋ 2 ͖ͨͭͪ ʙ2020/03 (ג)ΧϧςοτίϛϡχέʔγϣϯζCTO 📝 blog.ttskch.com/thank-you-quartet-communications @ttskch

Slide 3

Slide 3 text

/16 • डୗ։ൃͱࣾ֎CTO/ٕज़ސ໰ۀத৺Ͱ׆ಈͯ͠·͢ • Symfony͕େ޷͖Ͱ͢ ✨ • ڈ೥͸ΞυϕϯτΧϨϯμʔΛ1ਓͰ15೔ॻ͍ͨΓ 
 10ສจࣈͷిࢠॻ੶Λແྉެ։ͨ͠Γ͠·ͨ͠💪💪💪 3 ͖ͨͭͪ 2020/04ʙ ϑϦʔϥϯεWebΤϯδχΞ 👨💻 kannade.jp @ttskch

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

/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/

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

/16 • PHPͷϏϧυ͸৭Μͳϛυϧ΢ΣΞʹґଘ͍ͯͯ͠ɺԿ΋ͯ͠ͳ͍ͷʹյΕΔ ͜ͱ͕Α͋͘Δ্ʹτϥϒϧγϡʔτ͕େม͗͢Δ • ϏϧυΤϥʔΛղফ͠Α͏ͱඞਢͰάάͬͯͨΒ࠷ऴతʹ 
 Homebrew/homebrew-coreͷIssueͰ͢Ͱʹٞ࿦ࡁΈͩͬͨͷΛݟ͚ͭͯɺ 
 ࣗ෼͸ҰମԿΛ࠶ൃ໌͍ͯ͠ΔΜͩΖ͏͔ͱ͍͏ؾ࣋ͪʹͳΔ • Homebrewʹର͢ΔԼهͷΞυόϯςʔδ͸ଞͷखஈͰे෼୅ସͰ͖Δʢޙड़ʣ 1. ύονόʔδϣϯ୯ҐͰόʔδϣϯࢦఆͰ͖Δ 2. .php-version ͰσΟϨΫτϦ͝ͱʹPHPͷόʔδϣϯΛࢦఆͰ͖Δ 10 ΍Ίͨཧ༝

Slide 11

Slide 11 text

/16 • ࣮ࡍͷͱ͜Ζɺύονόʔδϣϯ·Ͱࢦఆ͍ͨ͠έʔεͳΜͯ΄΅ͳ͍🤦 • ΋͋ͬͨ͠Βͦͷ͚࣌ͩDocker࢖͑͹͍͍͔ͳ 11 1. ύονόʔδϣϯ୯ҐͰόʔδϣϯࢦఆͰ͖Δʁ

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

/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

Slide 14

Slide 14 text

/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/

Slide 15

Slide 15 text

/16 • phpenv on Mac͸೉͗͢͠Δ • Homebrewʹର͢ΔΞυόϯςʔδ͸ผͷπʔϧͳͲͰ୅ସՄೳ • ͜Ε͔Β͸ϏϧυͷͭΒΈΛ୅ΘΓʹ΍ͬͯ͘Ε͍ͯΔ͜ͱʹײँͭͭ͠ HomebrewͷPHPΛ࢖͍͖ͬͯ·͢😇 15 ·ͱΊ

Slide 16

Slide 16 text

/16 16 @ttskch ʘThanks!ʗ