[GH-ISSUE #118] Internal Server Error #71

Closed
opened 2026-02-27 19:25:53 +03:00 by kerem · 6 comments
Owner

Originally created by @justrealmilk on GitHub (Mar 21, 2018).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/118

Haven't had one of these useless Apache error pages in years.
Turned on PHP error display everywhere and got nothing.
This is in the server log.

[Tue Mar 20 18:15:45 2018] [warn] [client 211.31.38.161, ] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Tue Mar 20 18:15:45 2018] [error] [client 211.31.38.161, ] Premature end of script headers: callback.php
[Tue Mar 20 18:16:41 2018] [warn] [client 211.31.38.161, ] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Tue Mar 20 18:16:41 2018] [error] [client 211.31.38.161, ] Premature end of script headers: callback.php
[Tue Mar 20 18:16:42 2018] [warn] [client 211.31.38.161, ] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Tue Mar 20 18:16:42 2018] [error] [client 211.31.38.161, ] Premature end of script headers: callback.php

// this is where I turned off FastCGI to see if it would help

[Tue Mar 20 18:18:59 2018] [error] [client 211.31.38.161, ] Premature end of script headers: php-latest
[Tue Mar 20 18:19:00 2018] [error] [client 211.31.38.161, ] Premature end of script headers: php-latest
[Tue Mar 20 18:19:30 2018] [error] [client 211.31.38.161, ] Premature end of script headers: php-latest

I followed the authorization code flow quickstart and narrowed it down to $session->requestAccessToken($_GET['code']); in the callback

It grabs the code from Spotify fine and then blows up. I looked at the function in Session.php and it seems to simple to not work so I dunno haha

Originally created by @justrealmilk on GitHub (Mar 21, 2018). Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/118 Haven't had one of these useless Apache error pages in years. Turned on PHP error display everywhere and got nothing. This is in the server log. > [Tue Mar 20 18:15:45 2018] [warn] [client 211.31.38.161, ] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server > [Tue Mar 20 18:15:45 2018] [error] [client 211.31.38.161, ] Premature end of script headers: callback.php > [Tue Mar 20 18:16:41 2018] [warn] [client 211.31.38.161, ] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server > [Tue Mar 20 18:16:41 2018] [error] [client 211.31.38.161, ] Premature end of script headers: callback.php > [Tue Mar 20 18:16:42 2018] [warn] [client 211.31.38.161, ] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server > [Tue Mar 20 18:16:42 2018] [error] [client 211.31.38.161, ] Premature end of script headers: callback.php > > // this is where I turned off FastCGI to see if it would help > > [Tue Mar 20 18:18:59 2018] [error] [client 211.31.38.161, ] Premature end of script headers: php-latest > [Tue Mar 20 18:19:00 2018] [error] [client 211.31.38.161, ] Premature end of script headers: php-latest > [Tue Mar 20 18:19:30 2018] [error] [client 211.31.38.161, ] Premature end of script headers: php-latest I followed the authorization code flow quickstart and narrowed it down to `$session->requestAccessToken($_GET['code']);` in the callback It grabs the code from Spotify fine and then blows up. I looked at the function in Session.php and it seems to simple to not work so I dunno haha
kerem closed this issue 2026-02-27 19:25:54 +03:00
Author
Owner

@justrealmilk commented on GitHub (Mar 21, 2018):

I should note: I'm not using Composer - I'm just doing the inline require_once business

<!-- gh-comment-id:374810799 --> @justrealmilk commented on GitHub (Mar 21, 2018): I should note: I'm not using Composer - I'm just doing the inline `require_once` business
Author
Owner

@jwilsson commented on GitHub (Mar 21, 2018):

Hi!
Could you post the code you're using?

Thanks!

<!-- gh-comment-id:375006409 --> @jwilsson commented on GitHub (Mar 21, 2018): Hi! Could you post the code you're using? Thanks!
Author
Owner

@justrealmilk commented on GitHub (Mar 21, 2018):

require_once('Request.php');
require_once('Session.php');
require_once('SpotifyWebAPI.php');
require_once('SpotifyWebAPIException.php');

$session = new SpotifyWebAPI\Session(
  'clientid',
  'clientsecret',
  'callbackuri'
);

// this line triggers the error
$session->requestAccessToken($_GET['code']);

$accessToken = $session->getAccessToken();
$refreshToken = $session->getRefreshToken();

echo $accessToken;
echo "<br>";
echo $refreshToken;

Send the user along and fetch some data!
header('Location: app.php');
die();
<!-- gh-comment-id:375095007 --> @justrealmilk commented on GitHub (Mar 21, 2018): ``` require_once('Request.php'); require_once('Session.php'); require_once('SpotifyWebAPI.php'); require_once('SpotifyWebAPIException.php'); $session = new SpotifyWebAPI\Session( 'clientid', 'clientsecret', 'callbackuri' ); // this line triggers the error $session->requestAccessToken($_GET['code']); $accessToken = $session->getAccessToken(); $refreshToken = $session->getRefreshToken(); echo $accessToken; echo "<br>"; echo $refreshToken; Send the user along and fetch some data! header('Location: app.php'); die();
Author
Owner

@jwilsson commented on GitHub (Mar 22, 2018):

Hmm, nothing strange there.

Could you drop a error_reporting(E_ALL); at the top and see if we get any better errors? You might need a ini_set('display_errors', 'on'); too.

<!-- gh-comment-id:375182515 --> @jwilsson commented on GitHub (Mar 22, 2018): Hmm, nothing strange there. Could you drop a `error_reporting(E_ALL);` at the top and see if we get any better errors? You might need a `ini_set('display_errors', 'on');` too.
Author
Owner

@justrealmilk commented on GitHub (Mar 22, 2018):

As I said, I already did that to no effect. I even turned them on in Session.php

<!-- gh-comment-id:375210978 --> @justrealmilk commented on GitHub (Mar 22, 2018): As I said, I already did that to no effect. I even turned them on in Session.php
Author
Owner

@jwilsson commented on GitHub (Mar 26, 2018):

As I said, I already did that to no effect. I even turned them on in Session.php

Right, sorry!

I don't know what to tell you, though. I've never seen that error message before, and a quick Google search gives all kind of different reasons for it. I guess you'll just have to try one of those solutions for it.

<!-- gh-comment-id:376253639 --> @jwilsson commented on GitHub (Mar 26, 2018): > As I said, I already did that to no effect. I even turned them on in Session.php Right, sorry! I don't know what to tell you, though. I've never seen that error message before, and a quick Google search gives all kind of different reasons for it. I guess you'll just have to try one of those solutions for it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-web-api-php#71
No description provided.