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

自作OSSとPHP7対応

F4d37a67ce86b2f962c79d73a9127d3c?s=47 fortkle
February 05, 2016

 自作OSSとPHP7対応

F4d37a67ce86b2f962c79d73a9127d3c?s=128

fortkle

February 05, 2016
Tweet

Transcript

  1. ࣗ࡞OSSͱPHP7ରԠ ߴ໺ ෱ߊ @fortkle - PHP7 Casual Talks #1

  2. ࣗݾ঺հ • @fortkle • Connehito גࣜձࣾ (ϚϚ޲͚αʔϏε mamari) • ੜਮͷPHPer

    • ࠷ۙͷझຯ͸ɺGoͰWebΞϓϦέʔγϣϯ։ൃ
  3.  ϝσΟΞ ϢʔβʔࢀՃܕΞϓϦ mamari jp mamari Q ϚϚͷ 3ਓʹ1ਓ ͕ར༻ʂ

    ࢀরɿGoogle Analytics ݄ؒར༻ऀ 400ສਓ Ҏ্ ϚϚϦ ͸೛৷ɾग़࢈ɾࢠҭͯதͷ ঁੑʹ޲͚ͨϝσΟΞ&ίϛϡχςΟͰ͢ɻ
  4. ͋Δ೔ͷCTOͱͷձ࿩

  5. CTOʮPHP7͍͜͏ʯ @fortkleʮPHP7͍͖·͠ΐ͏ʯ

  6. PHP7ಋೖܾఆ

  7. CTOʮ͓͠ʂ·ͣ͸͋ͷ؅ཧը໘ͩɻ
 ɹɹɹPHP5.4͔ΒͷҠߦཔΜͩͧʂʯ @fortkleʮ΍Γ·͠ΐ͏ʂ 
 ɹɹɹɹɹ(…ͯ͞ɺͲ͏ͨ͠΋ͷ͔)ʯ

  8. PHP7Ҡߦͷน͕… • ѹ౗త @fortkle ͷPHP7ܦݧ஋ෆ଍ • ࣮ࡍʹ࢖͍ͬͯΔطଘΞϓϦέʔγϣϯΛ
 PHP7ʹ৐ͤ׵͑ͨ͜ͱ͕ͳ͔ͬͨ • Կ͔ੜ͚ᩴͰ΋͋Ε͹1౓ࢼ͠t(…

  9. ͍΍ɺੜ͚ᩴͳΒ͋Δ…!

  10. ࣗ࡞OSSͷ৘ใڞ༗πʔϧ

  11. None
  12. None
  13. None
  14. owl/owl • ࣗ࡞ͨ͠OSSͷ৘ใڞ༗πʔϧ (Laravel੡) • ex. ) Qiita:Team, esa.io, Docbase

    …etc • ϝϞπʔϧͱͯ͠Evernoteͷ୅ΘΓʹݸਓ࢖༻ • AWS্Ͱಈ͔ͯ͠ຖ೔࢖͍ͬͯΔ • https://github.com/owl/owl
  15. ͜ΕΛPHP7ʹ৐ͤ׵͑ʂ OSSੜ͚ᩴϝιου(Ծ)

  16. ͱ͍͏༁Ͱ ࣗ࡞OSSͷPHP7ରԠ

  17. owlͷঢ়گ • Laravel 5.0.33 • Server • CentOS6.5 • PHP5.4

    • SQLite3 • Apache + mod_php
  18. PHP7৐ͤ׵͑5ͭͷϙΠϯτ 1. ૬खΛ஌ΔɺΰʔϧΛܾΊΔ 2. ؀ڥͷίʔυԽ 3. ϥΠϒϥϦɺϞδϡʔϧͷରԠঢ়گΛνΣοΫ 4. ΞϓϦ෦෼ͷରԠঢ়گΛνΣοΫ 5.

    ςετΛճ͢
  19. 1. ૬खΛ஌ΔɺΰʔϧΛܾΊΔ

  20. 1. ૬खΛ஌ΔɺΰʔϧΛܾΊΔ • PHP7Ͱͷมߋ఺ɺޙํޓ׵ੑͷཧղ • ʮPHP 5.6.x ͔Β PHP 7.0.x

    ΁ͷҠߦʯ
 http://php.net/manual/ja/migration70.php
 • ʮPHP7ͰมΘΔ͜ͱ ——ݴޠ࢓༷ͱΤϯδϯͷվળϙΠϯτʯ
 http://www.slideshare.net/hnw/phpcon-kansai20150530
  21. 1. ૬खΛ஌ΔɺΰʔϧΛܾΊΔ • ࠓճ͸ʮPHP7Β͠͞ʯ͸ٻΊͣɺ৐ͤ׵͑ࣗ ମΛΰʔϧʹ͠଎౓޲্Λ໨తͱͨ͠ PHP7Β͠͞ ߴ PHP7Β͠͞ ௿ ɾͨͩ৐ͤ׵͚͑ͨͩ

    ɾPHP7Ͱొ৔ͨ͠৽͍͠ԋࢉࢠɺߏจͷ׆༻ ɾεΧϥʔ஋ͷܕએݴɺ໭Γ஋ͷܕએݴ ɾແ໊Ϋϥε ɾNull߹ମԋࢉࢠɺӉ஦ધԋࢉࢠ ← ɹɹɹࠓճ͸ͪ͜Βʂ
  22. 2. ؀ڥͷίʔυԽ

  23. 2. ؀ڥͷίʔυԽ • PHP7ͰऴΘΓͰ͸ͳ͍ • 8,9ͱࠓޙ΋ܧଓతʹVerUp͢Δඞཁ͕͋Δ • VerUpʹରͯ͠ʢมԽʹରͯ͠ʣରԠ͢ΔͨΊ ʹඞཁͳͷ͕ʮ؀ڥͷίʔυԽʯɻ
 ߏ੒؅ཧΛ͠Α͏ɻ

  24. 2. ؀ڥͷίʔυԽ • Մಡੑɺอकੑɺႈ౳ੑ • ϓϩϏδϣχϯάπʔϧΛ׆༻͢Δ • Ansible • ʮInstall

    PHP7 on CentOS7 by Ansibleʯ
 http://www.slideshare.net/DQNEO/install-php7-on-centos7-by-ansible • Itamae • ձࣾͰͪ͜ΒΛ࢖ͬͯΔͷͰowl͸ͪ͜Β • chefΑΓγϯϓϧ • PHP7.0.2ɺSQlite3ɺnginx+PHP-FPMɺCentOS7؀ڥΛߏங
  25. 3. ϥΠϒϥϦɺϞδϡʔϧͷ ରԠঢ়گΛνΣοΫ

  26. 3. ϥΠϒϥϦɺϞδϡʔϧͷ
 ରԠঢ়گΛνΣοΫ • ϥΠϒϥϦ,WAFͷରԠঢ়گ • ʮ˓˓ PHP7ʯͰάάΕ͹େମ෼͔Δ • ओཁͳ΋ͷ͸طʹPHP7ରԠࡁΈ

    • ϞδϡʔϧͷରԠঢ়گ • ঢ়گΛ·ͱΊ͍ͯΔPJT͕͋Δ
 https://github.com/gophp7/gophp7-ext/wiki/ extensions-catalog
  27. 4. ΞϓϦ෦෼ͷରԠঢ়گΛ νΣοΫ

  28. 4. ΞϓϦ෦෼ͷରԠঢ়گΛνΣοΫ • αʔόʔɺϞδϡʔϧɺϥΠϒϥϦɺWAFͰ໰ ୊ͳͯ͘΋ɺΞϓϦ͕PHP7ඇରԠͳΒҙຯ͕ ແ͍ • खͬऔΓૣ͘PHP7ରԠΛνΣοΫ͢Δʹ͸
 php7cc Λ࢖͏ͷ͕Φεεϝ


    https://github.com/sstalle/php7cc
  29. 4. ΞϓϦ෦෼ͷରԠঢ়گΛνΣοΫ • php7cc • PHP7ͱͷద߹ੑΛνΣοΫͯ͘͠ΕΔ // μ΢ϯϩʔυ $ wget

    https://github.com/sstalle/php7cc/releases/ download/1.0.2/php7cc.phar 
 // νΣοΫ(ϑΝΠϧ or ϑΥϧμΛ౉͢) $ php php7cc.phar --extensions=php ./index.php
  30. 4. ΞϓϦ෦෼ͷରԠঢ়گΛνΣοΫ • νΣοΫର৅ͷ index.php <?php class String{ public $hoge

    = "hoge"; public function String() { echo "construct!!"; } public function echoHoge() { echo $this->hoge; } }
  31. 4. ΞϓϦ෦෼ͷରԠঢ়گΛνΣοΫ • ݁Ռ $ php php7cc.phar --extensions=php ./index.php File:

    /Users/fortkle/Private/owl/index.php > Line 3: Reserved name "string" used as a class, interface or trait name class String { } > Line 7: PHP 4 constructors are now deprecated public function String() { }
  32. 4. ΞϓϦ෦෼ͷରԠঢ়گΛνΣοΫ • ͪͳΈʹ… • owl Ͱ΋࣮ߦͨ͠ͱ͜Ζɺमਖ਼͕ඞཁͳՕॴ ͸ 0 Ͱͨ͠ʢPHP7ͷޙํޓ׵ੑߴ͍ʂʣ

  33. 5. ςετΛճ͢

  34. 5. ςετΛճ͢ • 4. ͷphp7ccͳͲΛ׆༻ͯ͠PHP7ʹରԠͰ͖ͯ ͍ͳ͍ίʔυΛमਖ਼͢Δ • ςετΛ࣮ߦ͠ɺΞϓϦέʔγϣϯ͕յΕ͍ͯ ͳ͍͔ɺ͓͔͠ͳͱ͜Ζ͸ͳ͍͔νΣοΫ •

    TravisCIͳΒ1ߦ෇͚Ճ͑Δ͚ͩͰPHP7ରԠՄ $ cat .travis.yml language: php php:
 - 5.6 - 7.0
  35. Ҏ্ͷεςοϓΛܦͯ…

  36. Ҡߦ׬ྃʂʂʂ • ໿40~50%΄ͲϖʔδಡΈࠐΈ଎౓͕վળʂ Buildin Server + Laravel DebugbarͰ5ճͣͭܭଌ

  37. Ҡߦ׬ྃʂʂʂ Buildin Server + Laravel DebugbarͰ5ճͣͭܭଌ

  38. Ҡߦ׬ྃʂʂʂ • PHP7Ҡߦͷܦݧ஋ήοτʂ • PHP7 Support ͷowlΛϦϦʔεʂ

  39. ͦͷޙ…

  40. ಉ༷ͷखॱͰ؅ཧը໘ͷPHP7Ҡߦ • खॱ͸શ͘มΘΒͳ͍ • ΰʔϧ͕ܾ·͍ͬͯΔͷͰແཧͳ͘Ͱ͖Δ • ϨΠϠʔຖʹஸೡʹ࡞ۀ͍ͯ͘͠ख๏ͳͷͰ
 ҆৺Ͱ͖Δ( ˘ω˘)ţźō •

    ܧଓతͳվળ͕Ͱ͖ΔʢPHP7͕ۀ຿Ͱ࢖͑ͯϞνϕʔ γϣϯ͕͕͋Δʂʂʂˡॏཁʣ
  41. ·ͱΊ • झຯ(OSS)ͰϦεΫΛ๯͠ɺۀ຿ʹͦΕΛؐݩ͢Δ ʮOSSੜ͚ᩴϝιουʯ͕ྑ͍ • PHP7Ҡߦ͸ϨΠϠʔຖʹ෼͚ͯςετ͍͚ͯ͠͹ ൺֱత༰қʢPHP7Β͠͞Λ௥ٻ͢Δͱ೉қ౓ˢʣ • PHP7Λۀ຿Ͱ΋࢖͑Δͱָ͍͠ ✌('ω')✌

  42. ͓͠·͍