update README

This commit is contained in:
Dengke Tang
2023-02-27 16:35:48 -08:00
parent 202fd2e901
commit ec1dce037f
2 changed files with 51 additions and 28 deletions
+47 -25
View File
@@ -3,52 +3,74 @@
## Requirements ## Requirements
* PHP 5.5+ on UNIX platforms, 7.2+ on Windows * PHP 5.5+ on UNIX platforms, 7.2+ on Windows
* CMake 3.x * CMake 3.x
* GCC 4.4+, clang 3.8+ on UNIX, Visual Studio 2017 build tools on Windows * GCC 4.4+, clang 3.8+ on UNIX, Visual Studio build tools on Windows
* Tests require [Composer](https://getcomposer.org) * Tests require [Composer](https://getcomposer.org)
## Installation
The package has two different package published to [composer](https://packagist.org/packages/aws/aws-crt-php) and [PECL](https://pecl.php.net/package/awscrt).
On UNIX, you can get the package from package manager or build from source:
```
pecl install awscrt
composer require aws/aws-crt-php
```
On Windows, you need to build from source as instruction written below for the native extension `php_awscrt.dll`. And, follow https://www.php.net/manual/en/install.pecl.windows.php#install.pecl.windows.loading to load extension. After that:
```
composer require aws/aws-crt-php
```
## Building on UNIX ## Building on UNIX
```sh ```sh
$ git clone --recursive https://github.com/awslabs/aws-crt-php.git $ git clone --recursive https://github.com/awslabs/aws-crt-php.git
$ cd aws-crt-php $ cd aws-crt-php
$ phpize $ phpize
$ ./configure $ ./configure
$ make && make test $ make
$ ./dev-scripts/run_tests.sh
``` ```
## Building on Windows ## Building on Windows
* First, ensure that you are able to build PHP on windows via the PHP SDK (this example assumes installation of the SDK to C:\php-sdk and that you've checked out the PHP source to php-src within the build directory). The following resources are helpful to get PHP building on windows:
### Requirements for Windows
* Ensure that you are able to build PHP on windows via the PHP SDK (this example assumes installation of the SDK to C:\php-sdk and that you've checked out the PHP source to php-src within the build directory). The following resources are helpful to get PHP building on windows:
* https://github.com/microsoft/php-sdk-binary-tools * https://github.com/microsoft/php-sdk-binary-tools
* https://medium.com/@erinus/how-to-build-php-on-windows-a7ad0a87862a
* https://medium.com/@erinus/how-to-build-php-extension-on-windows-d1667290f809 * Ensure you have "Development package (SDK to develop PHP extensions)" and PHP available from your system path. You can download them from https://windows.php.net/download/. You can check if they are available by running `phpize -v` and `php -v`
### Instructions
From Command Prompt (not powershell). The instruction is based on Visual Studio 2019 on 64bit Windows.
``` bat ``` bat
""" From VS2017 Command Prompt > git clone --recursive https://github.com/awslabs/aws-crt-php.git
> C:\php-sdk\phpsdk-vc15-x64.bat > git clone https://github.com/microsoft/php-sdk-binary-tools.git C:\php-sdk
> C:\php-sdk\phpsdk-vs16-x64.bat
C:\php-sdk\ C:\php-sdk\
$ phpsdk_buildtree php-<version> $ cd <your-path-to-aws-crt-php>
C:\php-sdk\php-<version>\vc15\x64\ <your-path-to-aws-crt-php>\
$ git clone https://github.com/php/php-src.git && cd php-src $ phpize
""" This only has to be done once, the first time you set this all up # --with-prefix only required when your php runtime in system path is different than the runtime you wish to use.
C:\php-sdk\php-<version>\vc15\x64\php-src <your-path-to-aws-crt-php>\
$ phpsdk_deps --update --branch <php-major.minor-version> $ configure --enable-awscrt=shared --with-prefix=<your-path-to-php-prefix>
C:\php-sdk\php-<version>\vc15\x64\php-src <your-path-to-aws-crt-php>\
$ git clone --recursive https://github.com/awslabs/aws-crt-php.git ..\pecl\awscrt
C:\php-sdk\php-<version>\vc15\x64\php-src
$ buildconf
C:\php-sdk\php-<version>\vc15\x64\php-src
$ configure --enable-cli --with-openssl --enable-awscrt=shared
C:\php-sdk\php-<version>\vc15\x64\php-src
$ nmake $ nmake
C:\php-sdk\php-<version>\vc15\x64\php-src <your-path-to-aws-crt-php>\
$ nmake test-awscrt $ nmake generate-php-ini
# check .\php-win.ini, it now has the full path to php_awscrt.dll that you can manually load to your php runtime, or you can run the following command to run tests and load the required native extension for awscrt.
<your-path-to-aws-crt-php>\
$ .\dev-scripts\run_tests.bat <your-path-to-php-binary>
``` ```
Note: for VS2017, Cmake will default to build for Win32, refer to [here](https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2015%202017.html). If you are building for x64 php, you can set environment variable as follow to let cmake pick x64 compiler. Note: for VS2017, Cmake will default to build for Win32, refer to [here](https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2015%202017.html). If you are building for x64 php, you can set environment variable as follow to let cmake pick x64 compiler.
+2 -1
View File
@@ -15,7 +15,8 @@
}, },
"minimum-stability": "alpha", "minimum-stability": "alpha",
"require": { "require": {
"php": ">=5.5" "php": ">=5.5",
"ext-awscrt": "*"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit":"^5.6.3" "phpunit/phpunit":"^5.6.3"