support 7.2+ from pecl and add readme stuff about libcrypto issues

This commit is contained in:
Dengke Tang
2023-03-21 15:17:25 -07:00
parent 9db4948118
commit 363b693384
7 changed files with 17 additions and 13 deletions
+2 -3
View File
@@ -19,11 +19,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Setup PHP with Xdebug - name: Setup PHP with Xdebug
uses: shivammathur/setup-php@verbose uses: shivammathur/setup-php@v2
with: with:
coverage: xdebug coverage: xdebug
php-version: 5.5 php-version: 5.5
extensions: crypto
ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false
- name: Checkout - name: Checkout
@@ -38,7 +37,7 @@ jobs:
run: | run: |
phpize phpize
./configure ./configure
make USE_OPENSSL=OFF make
./dev-scripts/run_tests.sh ./dev-scripts/run_tests.sh
php-linux-x64: php-linux-x64:
+12 -3
View File
@@ -1,6 +1,7 @@
# AWS Common Runtime PHP bindings # AWS Common Runtime PHP bindings
## 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 build tools on Windows * GCC 4.4+, clang 3.8+ on UNIX, Visual Studio build tools on Windows
@@ -17,7 +18,7 @@ pecl install awscrt
composer require aws/aws-crt-php 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: 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 composer require aws/aws-crt-php
@@ -46,7 +47,7 @@ $ ./dev-scripts/run_tests.sh
From Command Prompt (not powershell). The instruction is based on Visual Studio 2019 on 64bit Windows. From Command Prompt (not powershell). The instruction is based on Visual Studio 2019 on 64bit Windows.
``` bat ```bat
> git clone --recursive https://github.com/awslabs/aws-crt-php.git > git clone --recursive https://github.com/awslabs/aws-crt-php.git
> git clone https://github.com/microsoft/php-sdk-binary-tools.git C:\php-sdk > git clone https://github.com/microsoft/php-sdk-binary-tools.git C:\php-sdk
> C:\php-sdk\phpsdk-vs16-x64.bat > C:\php-sdk\phpsdk-vs16-x64.bat
@@ -80,6 +81,7 @@ set CMAKE_GENERATOR_PLATFORM=x64
``` ```
## Debugging ## Debugging
Using [PHPBrew](https://github.com/phpbrew/phpbrew) to build/manage multiple versions of PHP is helpful. Using [PHPBrew](https://github.com/phpbrew/phpbrew) to build/manage multiple versions of PHP is helpful.
Note: You must use a debug build of PHP to debug native extensions. Note: You must use a debug build of PHP to debug native extensions.
@@ -96,13 +98,20 @@ $ ./configure
$ make CMAKE_BUILD_TYPE=Debug $ make CMAKE_BUILD_TYPE=Debug
``` ```
Ensure that the php you launch from your debugger is the result of `which php`, not just Ensure that the php you launch from your debugger is the result of `which php` , not just
the system default php. the system default php.
## Security ## Security
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
## Knowning OpenSSL related issue (Unix only)
* With php5.5 and openssl-3.0.2, signing functions will not work
* When your php loads a different version of openssl than your system openssl version, awscrt may fail to load.
The easiest workaround to those issue is to build from source and get aws-lc as libscrypto for awscrt to depend on instead of your local openssl. Same instructions as [here](#building-from-github-source), but use `USE_OPENSSL=OFF make` instead of `make`
## License ## License
This project is licensed under the Apache-2.0 License. This project is licensed under the Apache-2.0 License.
+1 -1
View File
@@ -2,7 +2,7 @@
<dependencies> <dependencies>
<required> <required>
<php> <php>
<min>5.5.0</min> <min>7.2.0</min>
</php> </php>
<pearinstaller> <pearinstaller>
<min>1.10.0</min> <min>1.10.0</min>
-1
View File
@@ -22,5 +22,4 @@ if [ ! -d vendor ]; then
$PHP_BINARY -c php.ini $COMPOSER_BINARY update $PHP_BINARY -c php.ini $COMPOSER_BINARY update
fi fi
$launcher $PHP_BINARY --version
$launcher $PHP_BINARY -c php.ini vendor/bin/phpunit tests --debug $launcher $PHP_BINARY -c php.ini vendor/bin/phpunit tests --debug
+1
View File
@@ -60,6 +60,7 @@ ZEND_EXTERN_MODULE_GLOBALS(awscrt)
# define XRETURN_STRING(s) RETURN_STRING(s, 1) # define XRETURN_STRING(s) RETURN_STRING(s, 1)
# define XRETVAL_STRINGL(s, l) RETVAL_STRINGL(s, l, 1) # define XRETVAL_STRINGL(s, l) RETVAL_STRINGL(s, l, 1)
# define XRETVAL_STRING(s) RETVAL_STRING(s, 1) # define XRETVAL_STRING(s) RETVAL_STRING(s, 1)
/* zend_error_noreturn is not public until PHP7, but may still be visible with some PHP 5.X distributions */
# define zend_error_noreturn zend_error # define zend_error_noreturn zend_error
#endif /* PHP 5.x */ #endif /* PHP 5.x */
-4
View File
@@ -11,7 +11,6 @@ use AWS\CRT\Auth\Signing;
use AWS\CRT\Auth\Signable; use AWS\CRT\Auth\Signable;
use AWS\CRT\Auth\StaticCredentialsProvider; use AWS\CRT\Auth\StaticCredentialsProvider;
use AWS\CRT\HTTP\Request; use AWS\CRT\HTTP\Request;
use AWS\CRT\Log;
require_once('common.inc'); require_once('common.inc');
@@ -66,9 +65,6 @@ final class SigningTest extends CrtTestCase {
} }
public function testShouldSignHeader() { public function testShouldSignHeader() {
Log::setLogLevel(Log::TRACE);
$stdout = fopen('php://stdout', 'w');
Log::toStream($stdout);
$credentials_provider = new StaticCredentialsProvider([ $credentials_provider = new StaticCredentialsProvider([
'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID, 'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID,
'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY, 'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY,