Sonerezh / sonerezh

A self-hosted, web-based application to stream your music, everywhere.
https://www.sonerezh.bzh
GNU Affero General Public License v3.0
767 stars 122 forks source link

Error: Constant CAKE_CORE_INCLUDE_PATH already defined #357

Closed sbrl closed 5 years ago

sbrl commented 5 years ago

Hello,

I've just downloaded the latest version and attempted to run it, but I'm running into the following error:

018/12/31 21:28:49 [error] 24014#24014: *58 FastCGI sent in stderr: "PHP message: PHP Notice:  Constant CAKE_CORE_INCLUDE_PATH already defined in /srv/www/sonerezh/app/webroot/index.php on line 64
PHP message: PHP Warning:  include(/srv/www/sonerezh/Vendor/cakephp/cakephp/lib/Cake/bootstrap.php): failed to open stream: No such file or directory in /srv/www/sonerezh/app/webroot/index.php on line 94
PHP message: PHP Warning:  include(): Failed opening '/srv/www/sonerezh/Vendor/cakephp/cakephp/lib/Cake/bootstrap.php' for inclusion (include_path='.:/usr/share/php') in /srv/www/sonerezh/app/webroot/index.php on line 94
PHP message: PHP Fatal error:  CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your /cake core directory and your /vendors root directory. in /srv/www/sonerezh/app/webroot/index.php on line 99" while reading response header from upstream, client: x.y.z.w, server: , request: "GET /sonerezh/install HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "home.starbeamrainbowlabs.co.uk"

....the Vendor directory is inside app/, but Sonerezh isn't looking in the right place. A quick ln -s app/Vendor Vendor has provided a quick workaround, but I thought that you'd like to know about this.

System details:

Additional details available upon request :-)

lGuillaume124 commented 5 years ago

Hello,

Can you post the Nginx server block please?

sbrl commented 5 years ago

It's the one in the official docs, except I was running it under /sonerezh/ instead.

I've actually uninstalled sonerezh, as I'm unhappy with a few other things too (e.g. it turned every track in some albums into their own albums; lots of errors in the CLI; etc.). I'm currently looking for alternatively, but haven't found anything I'm willing to stick with yet

MightyCreak commented 5 years ago

I found that nginx doen't work very well with sub-folders (I always have problems no matter which service I install). On the other side, sub-domains works all the time.

If it turned some track in their own album, it's probably because the ID3 tags on these songs are bad. Personally, I prefer to fix my ID3 tags rather than having the application guessing what's the best for me.

I would guess your issue happens on a multi-artist album? In that case, you need to add a BAND name (for MP3s) or an ALBUMARTIST (for OGGs).

sbrl commented 5 years ago

....I see. For this specific album, I set the album tag with eyeD3:

eyeD3 --album "Album Name Here" *.mp3

I don't see an option in eyeD3 to set a band tag. Documenting the detection algorithm somewhere sounds like a good idea.

Personally, I would have thought that the album name / MusicBrainz ID / CD ID / etc. would be enough and way more accurate than whatever's been done currently.

lGuillaume124 commented 5 years ago

Sonerezh uses the standard MP3 tags (aka ID3v*) to fill the database. These information are extracted using the getID3() PHP library. We didn't reinvent the wheel :)

If you use ID3v2_4 (which is the latest ID3 standard), you can use the Band (or TPE2) tag. More info.

This tag should be properly filled if you use a tool relying on MusicBrainz for example. Personally, I'm using beets to manage my files and I never had any problem with it.

lGuillaume124 commented 5 years ago

Here is the Nginx configuration for https://www.sonerezh.bzh/demo/ (Sonerezh runs under the /demo/ subdir).

upstream php-fpm {
    server unix:/var/run/php-fpm.sock;
}

server {

  listen 145.239.197.172:443 ssl http2;
  listen [::]:443 ssl http2;
  server_name www.sonerezh.bzh;

  [...]

  location /demo {
    return 302 https://$host/demo/;
  }

  location /demo/ {
    alias /usr/share/nginx/sonerezh-demo/app/webroot/;
    try_files $uri $uri/ /demo//demo/index.php?$args;

    location ~* \/([^\/]+_[0-9]+x[0-9]+\.[a-z]+) {
      alias /usr/share/nginx/sonerezh-demo/app/webroot/;
      try_files /img/resized/$1 /demo/index.php?$args;
      expires 21d;
      access_log off;
      add_header Cache-Control 'public';
    }

    location ~ ^/demo/(.+\.php)$ {
      alias /usr/share/nginx/sonerezh-demo/app/webroot/$1;
      fastcgi_index index.php;
      fastcgi_pass php-fpm;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
    }

    location ~ ^/demo/(.+\.(css|js|woff|woff2))$ {
      alias /usr/share/nginx/sonerezh-demo/app/webroot/$1;
      expires 7d;
      access_log off;
      add_header Cache-Control 'public';
    }
  }
[...]
}