私はPHPのAndroidプッシュ通知スクリプトを持っています。スクリプトを実行すると、私のブラウザに次の応答 "504 Gateway Time-out nginx"が表示されます。私のサーバー上で 一般的なログの概要では、私は次のエラーを取得:Nginxが提供するPHP-FPM:504ゲートウェイのタイムアウト - nginx
2016/07/25 08:18:19 [error] 23882#0: *4375 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 12.34.567.891, server: website.com, request: "GET /gcm_test.php HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/website.com/php-fpm.sock", host: "www.website.com"
AndroidのプッシュPHPスクリプト:
proxy_error_logで私のサーバー上でError: 504, Message: GET /gcm_test.php HTTP/1.1, Source: nginx SSL access
を私は次のエラーを取得します
<?php
// Replace with the real server API key from Google APIs
$apiKey = "my apikey";
// Replace with the real client registration IDs
$registrationIDs = array("red id1", "reg id2");
// Message to be sent
$message = "Your message e.g. the title of post";
// Set POST variables
$url = 'https://gcm-http.googleapis.com/gcm/send';
$fields = array(
'registration_ids' => $registrationIDs,
'data' => array("message" => $message),
);
$headers = array(
'Authorization: key=' . $apiKey,
'Content-Type: application/json'
);
// Open connection
$ch = curl_init();
// Set the URL, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// Execute post
$result = curl_exec($ch);
// Close connection
curl_close($ch);
// print the result if you really need to print else neglate this
echo $result;
?>
"$ result = curl_exec($ ch);"という行を置き換えた場合、 "エコー"付きスクリプトの終わり ";"私はエラーがなく、結果は "スクリプトの終わり"です。 問題は "$ result = curl_exec($ ch);"という行にあるようです。
また、私は運がないとPLESK nginx 504 error: Gateway Timeout次を試しました。私のサーバ上で
私はnginxの
誰か任意のアイデアによって提供FPMアプリケーションとしてPHP7.0.4を実行していますか? ありがとう!