新版的hprose在nginx+php-fpm的環境下,會出現error500

allenplay 发布于 2015/05/05 14:58
阅读 1K+
收藏 0

@andot 你好,想跟你请教个问题:

新版的hprose,我在nginx+php-fpm下執行會出現500錯。

舊版在執行上沒有這個問題。

系統版本:

Centos6.6

nginx1.8.0

php 5.5.24

log檔的錯誤訊息:

2015/05/05 06:19:17 [error] 20080#0: *495 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'Hprose\Service' not found
 in /var/www/html/Service.php on line 24" while reading response header from up
stream, client: 59.127.132.128, server: mydomain.com, request: "GET /MemberAdmin/mis_api.php HTTP/1.1", upstream: "fastcgi://u
nix:/var/lib/php5-fpm/web2.sock:", host: "mydomain.com"
2015/05/05 06:19:19 [error] 20080#0: *497 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'Hprose\Service' not found
 in /var/www/html/Service.php on line 24" while reading response header from up
stream, client: 59.127.132.128, server: mydomain.com, request: "GET /MemberAdmin/mis_api.php HTTP/1.1", upstream: "fastcgi://u
nix:/var/lib/php5-fpm/web2.sock:", host: "mydomain.com"
2015/05/05 06:21:01 [error] 20080#0: *525 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'Hprose\Service' not found
 in /var/www/html/Service.php on line 24" while reading response header from up
stream, client: 59.127.132.128, server: mydomain.com, request: "GET /MemberAdmin/mis_api.php HTTP/1.1", upstream: "fastcgi://u
nix:/var/lib/php5-fpm/web2.sock:", host: "mydomain.com"
2015/05/05 06:23:19 [error] 20080#0: *531 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'Hprose\Client' not found
in /var/www/clients/client0/web2/web/api/Hprose/Http/Client.php on line 23" while reading response header from upstream, client: 5
9.127.132.168, server: mydomain.com, request: "GET /api/test.php HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/web2.s
ock:", host: "mydomain.com"
2015/05/05 06:26:11 [error] 20080#0: *569 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'Hprose\Client' not found
in /var/www/clients/client0/web2/web/api/Hprose/Http/Client.php on line 23" while reading response header from upstream, client: 5
9.127.132.168, server: mydomain.com, request: "GET /api/test.php HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/web2.s
ock:", host: "mydomain.com"
2015/05/05 06:26:43 [error] 20080#0: *580 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'Hprose\Service' not found
 in /var/www/html/Service.php on line 24" while reading response header from up
stream, client: 59.127.132.128, server: mydomain.com, request: "GET /MemberAdmin/mis_api.php HTTP/1.1", upstream: "fastcgi://u
nix:/var/lib/php5-fpm/web2.sock:", host: "mydomain.com"
2015/05/05 06:31:37 [error] 20080#0: *605 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'Hprose\Client' not found
in /var/www/clients/client0/web2/web/api/Hprose/Http/Client.php on line 23" while reading response header from upstream, client: 5
9.127.132.168, server: mydomain.com, request: "GET /api/test.php HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/web2.s
ock:", host: "mydomain.com"



加载中
0
andot
andot
这错误看上去是程序里没有 include Hprose 的主文件。
0
a
allenplay
<?php 
require_once('Hprose.php');

function test()
{
	return "test";
}
$server = new HproseHttpServer();
$server->addFunction('test');
$server->start();
?>

這是我的server端程序碼,在apache + php 環境可以正常執行,

但在nginx + php 的環境,就會出現500錯誤。 


0
andot
andot
你重新下载一下新版本试试看,我今晚刚刚更新了一下。重写了 Hprose.php。
0
a
allenplay

我更新了,仍有下列錯誤。

2015/05/11 07:17:38 [error] 25893#0: *277 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'HproseHttpServer' not found in /var/www/clients/client0/web2/web/api2/examples/http_server.php on line 17" while reading response header from upstream, client: 103.27.230.65, server: mydomain.com, request: "GET /api2/examples/http_server.php HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/web2.sock:", host: "mydomain.com"



0
andot
andot

这个问题已经解决了,是 spl_autoload 在 linux 下,只能加载小写字母的文件名造成的。新版本用 include 替换了 spl_autoload,不会再有这个问题了。

返回顶部
顶部