|
|
|
@ -12,24 +12,28 @@ shared C library. |
|
|
|
|
* `composer` |
|
|
|
|
* `phpunit` (optional) |
|
|
|
|
|
|
|
|
|
**Ubuntu/Debian:** |
|
|
|
|
**Install PHP and PECL on Ubuntu/Debian:** |
|
|
|
|
```sh |
|
|
|
|
$ sudo apt-get install php5 php5-dev |
|
|
|
|
$ sudo apt-get install php5 php5-dev php-pear |
|
|
|
|
|
|
|
|
|
OR |
|
|
|
|
|
|
|
|
|
$ sudo apt-get install php7.0 php7.0-dev php-pear |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
**PEAR/PECL:** |
|
|
|
|
**Install PECL on Mac:** |
|
|
|
|
```sh |
|
|
|
|
$ curl -O http://pear.php.net/go-pear.phar |
|
|
|
|
$ sudo php -d detect_unicode=0 go-pear.phar |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
**Composer:** |
|
|
|
|
**Install Composer (Linux or Mac):** |
|
|
|
|
```sh |
|
|
|
|
$ curl -sS https://getcomposer.org/installer | php |
|
|
|
|
$ sudo mv composer.phar /usr/local/bin/composer |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
**PHPUnit:** |
|
|
|
|
**Install PHPUnit (Linux or Mac):** |
|
|
|
|
```sh |
|
|
|
|
$ wget https://phar.phpunit.de/phpunit-old.phar |
|
|
|
|
$ chmod +x phpunit-old.phar |
|
|
|
@ -48,6 +52,14 @@ This will compile and install the gRPC PHP extension into the standard PHP |
|
|
|
|
extension directory. You should be able to run the [unit tests](#unit-tests), |
|
|
|
|
with the PHP extension installed. |
|
|
|
|
|
|
|
|
|
**Update php.ini** |
|
|
|
|
|
|
|
|
|
Add this line to your `php.ini` file, e.g. `/etc/php5/cli/php.ini` |
|
|
|
|
|
|
|
|
|
```sh |
|
|
|
|
extension=grpc.so |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Add the gRPC PHP library as a Composer dependency** |
|
|
|
|
|
|
|
|
@ -55,7 +67,7 @@ You need to add this to your project's `composer.json` file. |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
"require": { |
|
|
|
|
"grpc/grpc": "v1.0.0" |
|
|
|
|
"grpc/grpc": "v1.1.0" |
|
|
|
|
} |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
@ -96,14 +108,6 @@ $ make |
|
|
|
|
$ sudo make install |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
### Update php.ini |
|
|
|
|
|
|
|
|
|
Add this line to your `php.ini` file, e.g. `/etc/php5/cli/php.ini` |
|
|
|
|
|
|
|
|
|
```sh |
|
|
|
|
extension=grpc.so |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
## Unit Tests |
|
|
|
|
|
|
|
|
|
You will need the source code to run tests |
|
|
|
@ -138,7 +142,7 @@ $ composer install |
|
|
|
|
### Protobuf compiler |
|
|
|
|
|
|
|
|
|
Again if you don't have it already, you need to install the protobuf compiler |
|
|
|
|
`protoc`, version 3.1.0+. |
|
|
|
|
`protoc`, version 3.2.0+. |
|
|
|
|
|
|
|
|
|
If `protoc` hasn't been installed, you can download the `protoc` binaries from |
|
|
|
|
[the protocol buffers Github repository](https://github.com/google/protobuf/releases). |
|
|
|
@ -209,6 +213,7 @@ $ sudo apt-get install apache2 |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
Add this line to your `php.ini` file, e.g. `/etc/php5/apache2/php.ini` |
|
|
|
|
or `/etc/php/7.0/apache2/php.ini` |
|
|
|
|
|
|
|
|
|
```sh |
|
|
|
|
extension=grpc.so |
|
|
|
@ -235,7 +240,7 @@ $ cd grpc/src/php |
|
|
|
|
$ composer install |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
Make sure you have generated the client stub `math.php` |
|
|
|
|
Make sure you have generated the client stubs |
|
|
|
|
|
|
|
|
|
```sh |
|
|
|
|
$ ./bin/generate_proto_php.sh |
|
|
|
@ -247,11 +252,10 @@ Copy the `math_client.php` file into your Apache document root, e.g. |
|
|
|
|
$ cp tests/generated_code/math_client.php /var/www/html |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
You may have to fix the first two lines to point the includes to your installation: |
|
|
|
|
You may have to fix the first line to point the includes to your installation: |
|
|
|
|
|
|
|
|
|
```php |
|
|
|
|
include 'vendor/autoload.php'; |
|
|
|
|
include 'tests/generated_code/math.php'; |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
Connect to `localhost/math_client.php` in your browser, or run this from command line: |
|
|
|
@ -266,6 +270,10 @@ Install `nginx` and `php5-fpm`, in addition to `php5` above |
|
|
|
|
|
|
|
|
|
```sh |
|
|
|
|
$ sudo apt-get install nginx php5-fpm |
|
|
|
|
|
|
|
|
|
OR |
|
|
|
|
|
|
|
|
|
$ sudo apt-get install nginx php7.0-fpm |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
Add this line to your `php.ini` file, e.g. `/etc/php5/fpm/php.ini` |
|
|
|
@ -305,7 +313,7 @@ $ cd grpc/src/php |
|
|
|
|
$ composer install |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
Make sure you have generated the client stub `math.php` |
|
|
|
|
Make sure you have generated the client stubs |
|
|
|
|
|
|
|
|
|
```sh |
|
|
|
|
$ ./bin/generate_proto_php.sh |
|
|
|
@ -317,11 +325,10 @@ Copy the `math_client.php` file into your Nginx document root, e.g. |
|
|
|
|
$ cp tests/generated_code/math_client.php /var/www/html |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
You may have to fix the first two lines to point the includes to your installation: |
|
|
|
|
You may have to fix the first line to point the includes to your installation: |
|
|
|
|
|
|
|
|
|
```php |
|
|
|
|
include 'vendor/autoload.php'; |
|
|
|
|
include 'tests/generated_code/math.php'; |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
Connect to `localhost/math_client.php` in your browser, or run this from command line: |
|
|
|
|