Search code examples
mysqldatabasedebiansilverstripesilverstripe-4

Silverstripe 4.9.0 can't access CMS administration / Silverstripe Framework requires a "database" key in DB::getConfig()


I am a newbie to Linux and everything in its regard, but currently I am trying to get Silverstripe 4.9.0. running on a Debian 10 server. I ran into 2 problems, each one is appearing in one of two projects I made.

  1. Project 1 - After I used composer create-project silverstripe/installer my-project3 command to make an installation folder, I set my document root to be var/www/html/my-project3/public folder, as it was written in the documentation. I get this message after visiting the page in browser: Silverstripe Framework requires a "database" key in DB::getConfig(). Did you forget to set SS_DATABASE_NAME or SS_DATABASE_CHOOSE_NAME in your environment?

  2. Project 2 - Same problem, but I discovered that the first error can be fixed by editing .env file to set the environment etc. manually. I also prepared a database in MariaDB, and filled everything regarded to the database in the example.env file (after that renamed to just .env so it can be read by vendor/bin/sake dev/build command). However, as far as I know, this bypasses the basic installation through the browser itself, as Silverstripe gets everything it needs from the .env file. I am now able to see basic automatically-generated Home Page (nothing written about installation being successful tho, just the Your Site Name and menu with about us, contact...), but after attempting to visit CMS administration by simply adding /admin/ to my URL, I got this error:

     Not Found
    
     The requested URL was not found on this server.
    
     Apache/2.4.38 (Debian) Server at bis054.vse.cz Port 443
    

So now it is semi-functional, what I need is:

To get the first project working - to be able to see the installation web page, and then hopefully I would be able to set everything through the web interface itself, or to get the second project working - to find out why can't CMS administration be accessed, so as About us and Contact us page (gets me the exact same error). Found out that no admin folder or about-us folder is present in the /my-project/public subfolder.


Solution

  • EDIT - got the 2nd project working, posting for everyone that could potentially run into this problem, you have to add this to your /etc/apache2/sites-enabled/000-default.conf and also in 000-default-le-ssl.conf if you are using https. Set it for both both files, so it applies for both port 443 and port 80, just to be sure! It has to be set at the end of the config file right before VirtualHost ending.

    <Directory /var/www/html/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>