1. For the basic implementation of RPC based on Hprose for PHP 1.5.6 and Yii 2.0.7, please refer to the URL: https://www.shuijingwanwq.com/2016/03/24/953/
2. To upgrade Yii2 via Composer, execute the command: composer update, as shown in Figure 1:

3. Opening the URL: http://trade.service.ygt.cm/area/get-area-mobile , an error is reported, as shown in Figure 2:
PHP Warning – yii\base\ErrorException
include(E:\wwwroot\service.ygt.cm\vendor\hprose\hprose\src\Hprose\Yii\Server.php): failed to open stream: No such file or directory

4. After analyzing the cause, I found that after the upgrade, when committing to SVN, E:\wwwroot\service.ygt.cm\vendor\hprose\hprose\src\Hprose\Yii was already missing, as shown in Figure 3:

5. A screenshot of the source code in E:\wwwroot\service.ygt.cm\trade\controllers\HproseController.php shows that the referenced class file no longer exists, which naturally causes an error, as shown in Figure 4:

6. Opening the URL: https://github.com/hprose/hprose-php/wiki/%E5%AE%89%E8%A3%85 , I edited E:\wwwroot\service.ygt.cm\composer.json, as shown in Figure 5:
“require”: {
“hprose/hprose-yii”: “dev-master”
}

7. In Windows PowerShell, execute the command: composer update, as shown in Figure 6:
It installed yiisoft/yii, which can be ignored for now; it is recommended to remove it.

8. Opening the URL: http://trade.service.ygt.cm/area/get-area-mobile , an error is reported, as shown in Figure 7:
Unknown Property – yii\base\UnknownPropertyException
Getting unknown property: yii\web\Request::session

9. Edit E:\wwwroot\service.ygt.cm\vendor\hprose\hprose-yii\src\Hprose\Yii\Service.php, as shown in Figure 8:
// $context->session = $request->session;
$context->session = \Yii::$app->session;

10. Open the URL: http://trade.service.ygt.cm/area/get-area-mobile , as shown in Figure 9:

11. The client invocation throws an error, as shown in Figure 10:
Hprose\Future Object ( [state] => 1 [value] => Hprose\Future Object ( [state] => 0 [value] => [reason] => [subscribers:Hprose\Future:private] => Array ( ) ) [reason] => [subscribers:Hprose\Future:private] => Array ( ) )
![Client invocation throws an error: Hprose\Future Object ( [state] => 1 [value] => Hprose\Future Object ( [state] => 0 [value] => [reason] => [subscribers:Hprose\Future:private] => Array ( ) ) [reason] => [subscribers:Hprose\Future:private] => Array ( ) )](https://media.shuijingwanwq.com/2016/07/10-3.png)
12. Based on the prompt in Figure 6, install the pecl extension for Hprose for PHP. Installing it can effectively improve Hprose’s performance. Open the URL: https://github.com/hprose/hprose-php/wiki/hprose-%E7%9A%84-pecl-%E6%89%A9%E5%B1%95 , as shown in Figure 11:

13. After analysis, in version 2.0, client invocations are asynchronous by default. If a synchronous invocation is needed, set $async = false, as shown in Figure 12:

14. Run the client invocation, which works as expected, as shown in Figure 13:

