HHVM for PHP and Hack

34be88398f623c109b61d23e8215bd23?s=47 Mariusz Gil
September 27, 2014

HHVM for PHP and Hack

34be88398f623c109b61d23e8215bd23?s=128

Mariusz Gil

September 27, 2014
Tweet

Transcript

  1. 2.
  2. 3.
  3. 5.
  4. 6.
  5. 7.
  6. 8.
  7. 9.
  8. 10.
  9. 11.
  10. 12.
  11. 13.
  12. 17.
  13. 18.
  14. 19.
  15. 22.
  16. 23.
  17. 24.
  18. 26.

    HHVM OPEN SOURCE VIRTUAL MACHINE FOR PHP PHP5 SUPPORT* HACK

    SUPPORT JIT COMPILATION HHVM NATIVE INTERFACE FAST CGI SUPPORT CLI SUPPORT HPHPD
  19. 28.

    cat ./phpversion.php <?php ! var_dump(phpversion()); ! ! php -f ./phpversion.php

    string(16) "5.5.9-1ubuntu4.4" ! ! hhvm -f ./phpversion.php string(11) "5.6.99-hhvm"
  20. 29.

    cd/var/www/webapp; ! hhvm --mode server -vServer.Type=fastcgi -vServer.FileSocket=/var/run/hhvm/hhvm.sock -vAdminServer.Port=9001 ! !

    root /var/www/webapp; fastcgi_pass unix:/var/run/hhvm/hhvm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;
  21. 33.
  22. 35.

    HACK LANGUAGE FOR HHVM THAT INTEROPERATE SEAMLESSLY WITH PHP TYPE

    ANNOTATIONS TYPE ALIASING GENERICS NULLABLE TYPES COLLECTIONS CONTINUATIONS LAMBDAS ASYNC PROGRAMMING SHAPES TUPLES
  23. 36.

    <?hh ! class Mailbox<T> { private ?T $data; ! public

    function __construct() { $this->data = null; } ! public function put(T $mail): void { $this->data = $mail; } ! public function check(): ?T { if ($this->data !== null) { return $this->data; } return null; } }
  24. 37.

    cat ./test.hh <?hh ! function f(): Vector<T> { return 'not

    an Vector<T>'; } ! ! hh_client /home/vagrant/test.hh:3:22,22: You probably forgot to bind this type parameter right? Add <T> somewhere (after the function name definition, or after the class name) Examples: function foo<T> or class A<T> /home/vagrant/test.hh:4:10,27: Invalid return type /home/vagrant/test.hh:3:15,20: This is an object of type Vector /home/vagrant/test.hh:4:10,27: It is incompatible with a string
  25. 38.
  26. 39.

    sapi/cli/php -v PHP 7.0.0-dev (cli) (built: Sep 25 2014 22:05:10)

    Copyright (c) 1997-2014 The PHP Group Zend Engine v2.8.0-dev, Copyright (c) 1998-2014 Zend Technologies
  27. 42.
  28. 47.
  29. 49.