blob: 176bcfa0288796d8a290da10df7b07fcac17ee75 [file] [log] [blame] [view]
mlumishb892a272014-12-09 16:28:23 -08001# PHP wrapper for the GRPC interfaces.
2
3## LAYOUT
4
5Directory structure is as generated by the PHP utility
6[ext_skel](http://php.net/manual/en/internals2.buildsys.skeleton.php)
7
8## ENVIRONMENT
9
10To build a PHP environment that works with this extension, download and extract
11PHP 5.5 (5.6 may also work), configure it, and install it:
12
13```bash
14apt-get install libxml2 libxml2-dev
15curl http://php.net/get/php-5.5.16.tar.gz
16tar -xf php-5.5.16.tar.gz
17cd php-5.5.16
18./configure --with-zlib=/usr --with-libxml-dir=ext/libxml --with-openssl=/usr/local/ssl
19make
20make install
21```
22
23To also download and install the patched protoc and PHP code generator:
24
25```bash
26apt-get install -y procps
27curl -sSL https://get.rvm.io | sudo bash -s stable --ruby
28git clone sso://team/one-platform-grpc-team/protobuf
29cd protobuf
30./configure
31make
32make install
33git clone sso://team/one-platform-grpc-team/grpc-php-protobuf-php
34cd grpc-php-protobuf-php
35rake pear:package version=1.0
36pear install Protobuf-1.0.tgz
37```
38
39## BUILDING
40
41 1. In ./ext/grpc, run the command `phpize` (distributed with PHP)
42 2. Run `./ext/grpc/configure`
43 3. In ./ext/grpc, run `make` and `sudo make install`
44 4. In your php.ini file, add the line `extension=grpc.so` to load the
45 extension at PHP startup.
46
47## PHPUnit
48
49This repo now has PHPUnit tests, which can by run by executing
50`./bin/run_tests.sh` after building.
51
52There is also a generated code test (`./bin/run_gen_code_test.sh`), which tests
53the stub `./tests/generated_code/math.php` against a running localhost server
54serving the math service. That stub is generated from
55`./tests/generated_code/math.proto` with the head of the repo
56`sso://team/one-platform-grpc-team/grpc-php-protobuf-php`.