[GH-ISSUE #2] Error on Hosting the API #1

Closed
opened 2026-02-27 19:05:15 +03:00 by kerem · 9 comments
Owner

Originally created by @robsw on GitHub (Oct 5, 2022).
Original GitHub issue: https://github.com/akashrchandran/spotify-lyrics-api/issues/2

/lyrics/index.php
PHP Parse error: syntax error, unexpected ':', expecting ')' in /lyrics/index.php on line 24

Originally created by @robsw on GitHub (Oct 5, 2022). Original GitHub issue: https://github.com/akashrchandran/spotify-lyrics-api/issues/2 /lyrics/index.php PHP Parse error: syntax error, unexpected ':', expecting ')' in /lyrics/index.php on line 24
kerem closed this issue 2026-02-27 19:05:15 +03:00
Author
Owner

@akashrchandran commented on GitHub (Oct 6, 2022):

It seems that you might have edited the code, could you send screenshot of index.php at line 24.

<!-- gh-comment-id:1269308795 --> @akashrchandran commented on GitHub (Oct 6, 2022): It seems that you might have edited the code, could you send screenshot of index.php at line 24.
Author
Owner

@robsw commented on GitHub (Oct 6, 2022):

image
<!-- gh-comment-id:1269480765 --> @robsw commented on GitHub (Oct 6, 2022): <img width="523" alt="image" src="https://user-images.githubusercontent.com/14319800/194243696-a7b65740-e364-4586-bcb8-b96c05dbbc9b.png">
Author
Owner

@akashrchandran commented on GitHub (Oct 6, 2022):

You're using older version of PHP, please upgrade to PHP version >= 8.1

<!-- gh-comment-id:1270345387 --> @akashrchandran commented on GitHub (Oct 6, 2022): You're using older version of PHP, please upgrade to `PHP version >= 8.1`
Author
Owner

@robsw commented on GitHub (Oct 6, 2022):

Thanks, do you have an example of the config.json correct layout?

<!-- gh-comment-id:1270380699 --> @robsw commented on GitHub (Oct 6, 2022): Thanks, do you have an example of the config.json correct layout?
Author
Owner

@akashrchandran commented on GitHub (Oct 6, 2022):

The config.json is an auto generated cache file used to save token from spotify (they expire in an hour). You only need to set an environment variable SP_DC. SP_DC is cookie which is used to to authenticate against Spotify in order to have access to the required services. you can use this guide to find it.

github.com/akashrchandran/spotify-lyrics-api@9dbb9de5be/spotify.php (L9)

<!-- gh-comment-id:1270399298 --> @akashrchandran commented on GitHub (Oct 6, 2022): The config.json is an auto generated cache file used to save token from spotify (they expire in an hour). You only need to set an environment variable `SP_DC`. SP_DC is cookie which is used to to authenticate against Spotify in order to have access to the required services. you can use this [guide](https://github.com/akashrchandran/syrics/wiki/Finding-sp_dc) to find it. https://github.com/akashrchandran/spotify-lyrics-api/blob/9dbb9de5be8105c3c4d7eb5f961d03db1c1ff34f/spotify.php#L9
Author
Owner

@akashrchandran commented on GitHub (Oct 6, 2022):

I will add deployment part to the documentation (README) soon. That will make it lot easier for peeps who want to host it themselves.

<!-- gh-comment-id:1270404002 --> @akashrchandran commented on GitHub (Oct 6, 2022): I will add deployment part to the documentation (README) soon. That will make it lot easier for peeps who want to host it themselves.
Author
Owner

@robsw commented on GitHub (Oct 6, 2022):

Thanks its generated a config.json with an accessToken but when i try to make a call with an ID or URL it says lyrics not available but they get found on your api.

<!-- gh-comment-id:1270421305 --> @robsw commented on GitHub (Oct 6, 2022): Thanks its generated a config.json with an accessToken but when i try to make a call with an ID or URL it says lyrics not available but they get found on your api.
Author
Owner

@akashrchandran commented on GitHub (Oct 6, 2022):

Have you set SP_DC, otherwise the generated token will be a anonymous token (not linked to an account). You can check by opening the config.json file and checking the value of isAnonymous key. for example if token is not linked to an account the isAnonymous will be True.
image

If that's the case then check your SP_DC cookie and if it is correct, then delete the config.json file. It will make the script generate new token.

<!-- gh-comment-id:1270458031 --> @akashrchandran commented on GitHub (Oct 6, 2022): Have you set SP_DC, otherwise the generated token will be a anonymous token (not linked to an account). You can check by opening the config.json file and checking the value of isAnonymous key. for example if token is not linked to an account the isAnonymous will be `True`. ![image](https://user-images.githubusercontent.com/78685510/194381549-34cd7287-9f7f-438f-88b2-fc1295425c5a.png) If that's the case then check your SP_DC cookie and if it is correct, then delete the config.json file. It will make the script generate new token.
Author
Owner

@robsw commented on GitHub (Oct 6, 2022):

Ah thanks, I made a mistake setting up the environment variable, its all working now thank you so much!!!

<!-- gh-comment-id:1270486912 --> @robsw commented on GitHub (Oct 6, 2022): Ah thanks, I made a mistake setting up the environment variable, its all working now thank you so much!!!
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-lyrics-api#1
No description provided.