Skip to content
Snippets Groups Projects
Select Git revision
  • 6dd49a5c8f64369ebc269fdc41a97c4a27f160f5
  • master default protected
  • arm-aarch-platform
  • arm-platform
  • vjpai-patch-3
  • vjpai-patch-1
  • v1.27.x
  • jtattermusch-patch-2
  • jtattermusch-patch-1
  • update-java-worker-example-in-performance-docs
  • revert-21805-revert-21797-reintroduce_21527
  • revert-21804-tls-credentials-1
  • zhen_cleanup_namecheck
  • revert-21806-revert-21767-revert-21725-revert-21680-cq_ordering
  • vjpai-patch-2
  • revert-21766-tls-credentials-1
  • revert-21640-change_local_tcp_security_level
  • revert-21680-cq_ordering
  • revert-21527-unify_boringssl_deps2
  • revert-20803-grpclb_stabilization
  • fix-kokoro-rvm-key
  • v1.27.0
  • v1.27.0-pre2
  • v1.27.0-pre1
  • v1.26.0
  • v1.26.0-pre1
  • v1.25.0
  • v1.25.0-pre1
  • v1.24.3
  • v1.24.2
  • v1.24.1
  • v1.23.1
  • v1.24.0
  • v1.24.0-pre2
  • v1.24.0-pre1
  • v1.22.1
  • v1.23.0
  • v1.23.0-pre1
  • v1.22.0
  • v1.22.0-pre1
  • v1.21.4
41 results

php

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Vijay Pai authored
    Introduce multiple clocks to GPR
    d1c92540
    History

    #Overview

    This directory contains source code for PHP implementation of gRPC layered on shared C library.

    #Status

    Alpha : Ready for early adopters

    ENVIRONMENT

    Prerequisite: PHP 5.5 or later, phpunit, pecl

    Linux:

    $ sudo apt-get install php5 php5-dev phpunit php-pear

    OS X:

    $ curl https://phar.phpunit.de/phpunit.phar -o phpunit.phar
    $ chmod +x phpunit.phar
    $ sudo mv phpunit.phar /usr/local/bin/phpunit
    
    $ curl -O http://pear.php.net/go-pear.phar
    $ sudo php -d detect_unicode=0 go-pear.phar

    Build from Homebrew

    On Mac OS X, install homebrew. On Linux, install linuxbrew. Run the following command to install gRPC.

    $ curl -fsSL https://goo.gl/getgrpc | bash -s php

    This will download and run the gRPC install script and compile the gRPC PHP extension.

    Build from Source

    Clone this repository

    $ git clone https://github.com/grpc/grpc.git

    Build and install the Protocol Buffers compiler (protoc)

    $ cd grpc
    $ git pull --recurse-submodules && git submodule update --init --recursive
    $ cd third_party/protobuf
    $ ./autogen.sh
    $ ./configure
    $ make
    $ make check
    $ sudo make install

    Build and install the gRPC C core libraries

    $ cd grpc
    $ make
    $ sudo make install

    Install the gRPC PHP extension

    $ sudo pecl install grpc

    OR

    $ cd grpc/src/php/ext/grpc
    $ phpize
    $ ./configure
    $ make
    $ sudo make install

    In your php.ini file, add the line extension=grpc.so to load the extension at PHP startup.

    Install Composer

    $ cd grpc/src/php
    $ curl -sS https://getcomposer.org/installer | php
    $ php composer.phar install

    Unit Tests

    Run unit tests

    $ cd grpc/src/php
    $ ./bin/run_tests.sh

    Generated Code Tests

    Install protoc-gen-php

    $ cd grpc/src/php/vendor/datto/protobuf-php
    $ gem install rake ronn
    $ rake pear:package version=1.0
    $ sudo pear install Protobuf-1.0.tgz

    Generate client stub code

    $ cd grpc/src/php
    $ ./bin/generate_proto_php.sh

    Run a local server serving the math services

    • Please see Node on how to run an example server
    $ cd grpc/src/node
    $ npm install
    $ nodejs examples/math_server.js

    Run the generated code tests

    $ cd grpc/src/php
    $ ./bin/run_gen_code_test.sh