[GH-ISSUE #615] Manually set media_path in MySQL console, afterwards [ErrorException] unserialize(): Error at offset 0 of 28 bytes on php artisan koel:sync #439

Closed
opened 2026-02-26 02:33:13 +03:00 by kerem · 5 comments
Owner

Originally created by @ShenZhouHong on GitHub (Jun 21, 2017).
Original GitHub issue: https://github.com/koel/koel/issues/615

Because attempting to sync from web GUI results in Unknown error, I tried to sync koel using the console. However, when attempting to run php artisan koel:sync on the command line, the command complains that media_path is not set and terminates.

Knowing just enough MySQL to get into trouble, I attempted to set the media_path value manually in the MySQL console. I went to the settings table in the koel database, and set the value of media_path to '/home/koel/Music/'.

Unfortunately, that didn't solve the issue, and I think I broke something else. Perhaps it was not in the right data format? Now, when attempting to run 'php artisan koel:sync', the following output begets:


  [ErrorException]
  unserialize(): Error at offset 0 of 28 bytes

I definitely think I messed up the data format. @phanan How can I fix this? What would be the MySQL command that I can use to set the path properly in the correct data format? 😸

Many thanks!

P.S: Is there a command line option for specifying the media_path on sync? I looked through the docs, and the .env file, but didn't find any 😢

Originally created by @ShenZhouHong on GitHub (Jun 21, 2017). Original GitHub issue: https://github.com/koel/koel/issues/615 Because attempting to sync from web GUI results in `Unknown error`, I tried to sync koel using the console. However, when attempting to run `php artisan koel:sync` on the command line, the command complains that `media_path` is not set and terminates. Knowing just enough MySQL to get into trouble, I attempted to set the `media_path` value manually in the MySQL console. I went to the `settings` table in the `koel` database, and set the value of `media_path` to `'/home/koel/Music/'`. Unfortunately, that didn't solve the issue, and I think I broke something else. Perhaps it was not in the right data format? Now, when attempting to run 'php artisan koel:sync', the following output begets: ``` [ErrorException] unserialize(): Error at offset 0 of 28 bytes ``` I definitely think I messed up the data format. @phanan How can I fix this? What would be the MySQL command that I can use to set the path properly in the correct data format? 😸 Many thanks! P.S: Is there a command line option for specifying the `media_path` on sync? I looked through the docs, and the `.env` file, but didn't find any 😢
kerem closed this issue 2026-02-26 02:33:13 +03:00
Author
Owner

@ShenZhouHong commented on GitHub (Jun 21, 2017):

Update - I found an earlier (working) version of the koel database, and it appears the format is like this:

+------------+------------------------------------------------+
| key        | value                                          |
+------------+------------------------------------------------+
| media_path | s:38:"/home/koel/Music";                       |
+------------+------------------------------------------------+

How can I change the value to use the s:38 format? Is it some sort of weird, Sun-microsystems string? 😨

<!-- gh-comment-id:310053521 --> @ShenZhouHong commented on GitHub (Jun 21, 2017): Update - I found an earlier (working) version of the koel database, and it appears the format is like this: ``` +------------+------------------------------------------------+ | key | value | +------------+------------------------------------------------+ | media_path | s:38:"/home/koel/Music"; | +------------+------------------------------------------------+ ``` How can I change the value to use the `s:38` format? Is it some sort of weird, Sun-microsystems string? 😨
Author
Owner

@ShenZhouHong commented on GitHub (Jun 21, 2017):

Here's the comparison between the working MySQL database entry, and the nonfunctional one:

Working

mysql> describe settings;
+-------+--------------+------+-----+---------+-------+
| Field | Type         | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| key   | varchar(255) | NO   | PRI | NULL    |       |
| value | text         | NO   |     | NULL    |       |
+-------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

Broken (my current version)

mysql> describe settings;
+-------+--------------+------+-----+---------+-------+
| Field | Type         | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| key   | varchar(191) | NO   | PRI | NULL    |       |
| value | text         | NO   |     | NULL    |       |
+-------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

I definitely think the problem is in the varchar(191 value, but I have no idea how to fix it 😭

<!-- gh-comment-id:310058927 --> @ShenZhouHong commented on GitHub (Jun 21, 2017): Here's the comparison between the working MySQL database entry, and the nonfunctional one: ## Working ``` mysql> describe settings; +-------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+--------------+------+-----+---------+-------+ | key | varchar(255) | NO | PRI | NULL | | | value | text | NO | | NULL | | +-------+--------------+------+-----+---------+-------+ 2 rows in set (0.00 sec) ``` ## Broken (my current version) ``` mysql> describe settings; +-------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+--------------+------+-----+---------+-------+ | key | varchar(191) | NO | PRI | NULL | | | value | text | NO | | NULL | | +-------+--------------+------+-----+---------+-------+ 2 rows in set (0.00 sec) ``` I definitely think the problem is in the `varchar(191` value, but I have no idea how to fix it 😭
Author
Owner

@phanan commented on GitHub (Jun 21, 2017):

For your interest, s:38 means a string with 38 characters. See https://stackoverflow.com/a/14298662.

Don't modify the database directly. For now though, you can empty the value and then try again via the admin panel.

<!-- gh-comment-id:310061993 --> @phanan commented on GitHub (Jun 21, 2017): For your interest, `s:38` means a string with 38 characters. See https://stackoverflow.com/a/14298662. Don't modify the database directly. For now though, you can empty the value and then try again via the admin panel.
Author
Owner

@ShenZhouHong commented on GitHub (Jun 21, 2017):

Thank you. I fixed the database by recreating it and running php artisan koel:init, but once again the original error holds. Attempting to scan /home/koel/music/ results in Unknown Error. I can't find anything relevant in Nginx's error.log, and attempting to sync from the console results in the same media_path problem that lead me into this mess.

<!-- gh-comment-id:310064618 --> @ShenZhouHong commented on GitHub (Jun 21, 2017): Thank you. I fixed the database by recreating it and running `php artisan koel:init`, but once again the original error holds. Attempting to scan `/home/koel/music/` results in `Unknown Error`. I can't find anything relevant in Nginx's `error.log`, and attempting to sync from the console results in the same `media_path` problem that lead me into this mess.
Author
Owner

@ShenZhouHong commented on GitHub (Jun 21, 2017):

Nevermind. I just invoked chmod -R 777 /home/koel and it works now. I'll lock down the permissions later.

<!-- gh-comment-id:310066942 --> @ShenZhouHong commented on GitHub (Jun 21, 2017): Nevermind. I just invoked `chmod -R 777 /home/koel` and it works now. I'll lock down the permissions later.
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/koel-koel#439
No description provided.