Php error, On installing silverstripe on server

Silverstripe Version:

**Question:**Dear Friends . I am sending you from Greece. I have a student work for university and i choose your nice cms to work my little project. Everything was ok, i upload cms silverstripe on server, connect with database, i passed a few errors and try to install silverstripe to work with it. But i i have some errors again. One error is that.

Details of your query go here
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/html/dm/vatelld/silverstripe/framework/thirdparty/Zend/Cache/Backend.php on line 66

 public function __construct(array $options = array())
    {
        while (list($name, $value) = each($options)) {
            $this->setOption($name, $value);
        }
    }

The each() function was deprecated a long time ago in PHP, what version of Silverstripe are you using there? I’m guessing it’s probably quite old.

If this is a new installation, then you should grab a copy of the latest version 4, which should run properly on newer versions of PHP (up to 8.1)

Ok thanks Tim so i download a newer version of silverstripe (4.12.1 and install it via composer .
Now i get this error

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?

My database is already exist on phpmyadmin by university and i have to use that. I cant create a new one. I guess i have to make a change to files?

Simplest way is to add a .env file in the project root (if it doesn’t already exist), and add the relevant database information in there:

SS_DATABASE_SERVER='localhost'
SS_DATABASE_USERNAME='root'
SS_DATABASE_PASSWORD='root'
SS_DATABASE_NAME='mydatabase'
SS_ENVIRONMENT_TYPE='dev'

(Obviously those values are just examples)

Is any guide how i can add an .env file?

It’s just a plain text file, so you should be able to create it in a simple text editor and upload it to the server (in the web root for the site). The filename is just .env with no file extension on the end.