New default installation failed

Hi, I have run a vanilla install on my Opensuse Tumbleweed PC using composer and vendor/bin/sake dev/build for the database. The default location is /srv/www/htdocs. I added a .env file with the following -

SS_DATABASE_CLASS=“MySQLDatabase”
SS_DATABASE_SERVER=“localhost”
SS_DATABASE_USERNAME=“xxx”
SS_DATABASE_PASSWORD=“xxxxxx”
SS_DATABASE_NAME=“example”

SS_DEFAULT_ADMIN_USERNAME=“xxxxx”
SS_DEFAULT_ADMIN_PASSWORD=“xxxxx”

SS_ENVIRONMENT_TYPE=‘dev’

When I go to localhost/example/public I get the Home page with no formatting. Clicking on About Us, Contact Us and CMS gives “page not found”

Looking at the console with the Home page it says the css files are forbidden and the javascript file is not found.

I have phpMyAdmin running so can see the tables are correctly set up for the database example and SiteTree shows the expected pages.

Copying the theme folder into the public/_resources folder gave me the formatting but not the links. I was unable to find any log that might give an idea of the problem. Maybe it is permissions or paths that are the issue but I can not see anything in the installation guide to assist.

Any help would be appreciated.

You may need to add SS_BASE_URL to your .env configs

When I mouse over the hyperlink it is showing …/example/public/admin etc so I think that is not a problem. I did add it in case it helped but without success.

clicking on the link should go to the csm but I get -
Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404

That is not the custom 404 page either so other than the home pages nothing else is working.

Well, this looks like maybe your apache installation doesn’t have mod_rewrite enabled?
Does example/public/dev/build work?

No but here is part of .htaccess so rewrite is on

# Turn off index.php handling requests to the homepage fixes issue in apache >=2.4
<IfModule mod_dir.c>
    DirectoryIndex disabled
    DirectorySlash On
</IfModule>

SetEnv HTTP_MOD_REWRITE On
RewriteEngine On

Running /?flush also brings up errors even though wwwrun (apache) is part of the group that owns htdocs

[Warning] chmod(): Operation not permitted
GET /example/public/?flush

Line 367 in /srv/www/htdocs/example/vendor/league/flysystem/src/Adapter/Local.php

This might be because you ran sake dev/build from terminal not as wwwrun user (it’s doing flush as the user running sake).

Regarding the original issue, I’d try to put a symlink from htdocs to the public folder and see if it helps to deploy without any subfolders, and ensure that SS_BASE_URL is set properly (subfolders won’t work correctly without it anyways, but having it won’t hurt even without them). After all these steps I’d try to remove the database and run dev/build from the browser.
If all of these don’t help, I’d guess there’s something weird happening with mod_rewrite configs.

OK Serge, So I deleted the example folder in htdocs and reran

composer create-project silverstripe/installer example

using my own login in Konsole. It completed without errors. I then copied the .env file back into the example folder including the Base Url

then go to localhost/example/public in the browser which automatically goes to localhost/example/public/dev/build

and I get a 404 error - The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

.htaccess content -

SILVERSTRIPE START

Deny access to templates (but allow from localhost)

<Files *.ss>
Require ip 127.0.0.1

Deny access to IIS configuration

Require all denied

Deny access to YAML configuration files which might include sensitive information

<Files ~ “.ya?ml$”>
Require all denied

Route errors to static pages automatically generated by SilverStripe

ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html

# Turn off index.php handling requests to the homepage fixes issue in apache >=2.4
<IfModule mod_dir.c>
    DirectoryIndex disabled
    DirectorySlash On
</IfModule>

SetEnv HTTP_MOD_REWRITE On
RewriteEngine On

# Enable HTTP Basic authentication workaround for PHP running in CGI mode
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Deny access to potentially sensitive files and folders
RewriteRule ^vendor(/|$) - [F,L,NC]
RewriteRule ^\.env - [F,L,NC]
RewriteRule silverstripe-cache(/|$) - [F,L,NC]
RewriteRule composer\.(json|lock) - [F,L,NC]
RewriteRule (error|silverstripe|debug)\.log - [F,L,NC]

# Process through SilverStripe if no file with the requested name exists.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php
### SILVERSTRIPE END ###

That was automatically added by the build.

When I tried to run vendor/bin/sake dev/build as me in Konsole it had a lot of errors so I ran it as root. However, it seems the problem is before that point.

Well, the only idea I can suggest now is to add phpinfo or die to index.php, go to a 404 page and check if this routes to index.php or it’s apache’s own 404.