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

phpのビルドにつかれた ので phpenv+homebrew

uzulla
March 27, 2020

phpのビルドにつかれた ので phpenv+homebrew

2020/03/27 @ PHPerKaigi Online (仮)#1
uzulla

uzulla

March 27, 2020
Tweet

More Decks by uzulla

Other Decks in Programming

Transcript

  1. ఆ൪phpenv+php-build $ phpenv install 7.0.0 $ cd some/proj/ $ phpenv

    local 7.0.0 $ php -v php 7.0.0 ☞ ωΠςΠϒPHPer ఆ൪ͷπʔϧ ☞ ࣗ෼͸anyenv͔ΒͷphpenvͰ͢ ☞ ʢnodenvͱ͔rbenvͱ͔΋͍ΔͷͰʣ
  2. ࣮ମ͸͜͜ʹ͋Δ $ ls -al /usr/local/Cellar/ |grep php drwxr-xr-x 3 uzulla

    staff 96 3 10 13:30 php drwxr-xr-x 3 uzulla staff 96 10 16 21:43 [email protected] drwxr-xr-x 3 uzulla staff 96 10 16 21:43 [email protected]
  3. /usr/local/Cellar/php/7.4.3$ ls INSTALL_RECEIPT.json LICENSE NEWS README.md bin composer homebrew.mxcl.php.plist include

    lib pecl sbin share /usr/local/Cellar/php/7.4.3$ bin/php -v PHP 7.4.3 (cli) (built: Feb 20 2020 12:23:37) ( NTS )
  4. phpenv with brew's php $ ln -s /usr/local/Cellar/php/7.4.3 ~/.phpenv/versions/7.4.3 $

    phpenv local 7.4.3 $ php -v PHP 7.4.3 (cli) (built: Feb 20 2020 12:23:37) ( NTS ) ☞ That's all !! ☞ Զ͸ଵଦͳಲͰ͢!!
  5. ΓΖΜ ☞ phpenv/versionsҎԼʹɺ--prefix=hogeͳײ͡ͰϏϧυͨ͠ PHPΛࢦఆͰ͖Δ(SymlinkͰ΋ྑ͠) ☞ ln -s x.x.x ~/.phpenv/versions/brew ͱ͔Ͱ΋ok

    ☞ $ ln -s 7.4.3 ~/.phpenv/versions/7.4 $ phpenv local 7.4 ͷ΄͏͕ʢޙʑͷखؒΛߟ͑Δͱʣྑ͍͔΋ ☞ ʢࢲ͸php-build΋ࠞࡏ͍ͯ͠ΔͷͰɺbrew7.4.3ͱ͔΋ʣ
  6. ϙΠϯτ ☞ ln -s͸͠͹͠͹΍Γ௚͢ඞཁ͕͋Δ ☞ brew upgrade౳Ͱ͖͑ͨΓ͢ΔͷͰ ☞ ϝϯςόʔδϣϯ্͕͕ͬͨΓ͢Δͱ ☞

    brew಺ͷpackage໊͕࠷৽൛͸phpɺલ͸[email protected]Ͱඍົ͍ ☞ ·͋ɺյΕΕ͹ؾͮ͘͠ɺ͖͋ΒΊ·͠ΐ͏ ☞ ຖճϏϧυ͢ΔΑΓϚγʂ
  7. ☞ ಉ࣌ʹɺCellerͷதͷ php.ini͸ফ͑Δ ☞ ΞϓϦ಺Ͱಈతʹini_set͢Δ ☞ πʔϧͰͻͱखؒݮΒ͢ github/uzulla/setmyphpini.php ʮphp setmyphpini.php

    Λ࣮ߦ͢Δ͜ͱͰɺ࣮ߦͨ͠PHP ͷPHP_CONFIG_FILE_SCAN_DIRʢconf.dʣͷதʹ my_php.iniϑΝΠϧΛίϐʔ͠·͢ɻʯ
  8. C֦ு(ext)͸Ͳ͏͢Δͷʁ $ brew install pkg-config imagemagick $ phpenv version 7.4.3

    (set by ... $ pecl imagick ☞ ·͋ɺී௨ʹpeclͰ͍Ε·͢ɻphpenv͕ͪΌΜͱೖΕ͍ͨphp ʹ޲͍ͯΔ͔ݟ͔ͯΒ΍ͬͯͶ ☞ phpenvͷ͓͔͛Ͱpeclͱ͔phpize͸phpenv local/global͠ ͨ΋ͷʹPath͕ͱ͓͍ͬͯΔ͸ͣͰ͢ɺศརʂ
  9. ☞ ·ɺBrewͷPHP͸ʮେମʯೖ͍ͬͯΔ͚ͲͶ pear, bcmath, calendar, dba, dtrace, exif, ftp, fpm,

    intl, mbregex, mbstring, mysqlnd, opcache-file, pcntl, phpdbg, phpdbg-webhelper, shmop, soap, sockets, sysvmsg, sysvsem, sysvshm, wddx, zip, apxs2, bz2, curl, fpm-user, fpm-group, freetype-dir, gd, gettext, gmp, iconv, icu-dir, jpeg-dir, kerberos, layout, ldap, ldap-sasl, libxml-dir, libedit, libzip, mhash, mysql-sock, mysqli, ndbm, openssl, password-argon2, pdo-dblib, pdo-mysql, pdo-odbc, pdo-pgsql, pdo- sqlite, pgsql, pic, png-dir, pspell, sodium, sqlite3, tidy, unixODBC, webp-dir, xmlrpc, xsl, zlib ☞ imagickͱ͔ɺimagickͱ͔͸ͳ͍Ͷ…