Errors with Owncloud-MAMP-Mac

Hi everyone. I have been using Owncloud with MAMP PRO on Mac for several years and with satisfaction. Everything works perfectly. At the moment I’m switching to a more updated version of MAMP, with php 8. Owncloud, however, currently only works with php 7 and if I set MAMP with different php for each published site, it doesn’t take the HSTS setting. Also if I add files manually and then run the indexing with the command occ files:scan it doesn’t work and gives me database connection error. Can anyone give me some good advice to solve these two small problems?

Thanks in advance

update: to fix the HSTS error just set a single php for all sites, because the error appeared with different php for each site. As for the database connection error, when scanning the files, the terminal returns me these errors:

192:~ pillo$ php /Applications/MAMP/htdocs/owncloud/occ files:scan pillaccio

An unhandled exception has been thrown:

Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory in /Applications/MAMP/htdocs/owncloud/lib/private/DB/Connection.php:62

Stack trace:

#0 /Applications/MAMP/htdocs/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(475): OC\DB\Connection->connect()

#1 /Applications/MAMP/htdocs/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(437): Doctrine\DBAL\Connection->getDatabasePlatformVersion()

#2 /Applications/MAMP/htdocs/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(379): Doctrine\DBAL\Connection->detectDatabasePlatform()

#3 /Applications/MAMP/htdocs/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(844): Doctrine\DBAL\Connection->getDatabasePlatform()

#4 /Applications/MAMP/htdocs/owncloud/lib/private/DB/Connection.php(148): Doctrine\DBAL\Connection->setTransactionIsolation(2)

#5 /Applications/MAMP/htdocs/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(262): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDO\MySQL\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))

#6 /Applications/MAMP/htdocs/owncloud/lib/private/DB/ConnectionFactory.php(139): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))

#7 /Applications/MAMP/htdocs/owncloud/lib/private/Server.php(552): OC\DB\ConnectionFactory->getConnection(‘mysql’, Array)

#8 /Applications/MAMP/htdocs/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(122): OC\Server->OC{closure}(Object(OC\Server))

#9 /Applications/MAMP/htdocs/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet(‘DatabaseConnect…’)

#10 /Applications/MAMP/htdocs/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query(‘DatabaseConnect…’)

#11 /Applications/MAMP/htdocs/owncloud/lib/private/Server.php(1260): OC\ServerContainer->query(‘DatabaseConnect…’)

#12 /Applications/MAMP/htdocs/owncloud/lib/private/Server.php(424): OC\Server->getDatabaseConnection()

#13 /Applications/MAMP/htdocs/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(122): OC\Server->OC{closure}(Object(OC\Server))

#14 /Applications/MAMP/htdocs/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet(‘AppConfig’)

#15 /Applications/MAMP/htdocs/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query(‘AppConfig’)

#16 /Applications/MAMP/htdocs/owncloud/lib/private/Server.php(1190): OC\ServerContainer->query(‘AppConfig’)

#17 /Applications/MAMP/htdocs/owncloud/lib/private/Server.php(607): OC\Server->getAppConfig()

#18 /Applications/MAMP/htdocs/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(122): OC\Server->OC{closure}(Object(OC\Server))

#19 /Applications/MAMP/htdocs/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet(‘AppManager’)

#20 /Applications/MAMP/htdocs/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query(‘AppManager’)

#21 /Applications/MAMP/htdocs/owncloud/lib/private/Server.php(1458): OC\ServerContainer->query(‘AppManager’)

#22 /Applications/MAMP/htdocs/owncloud/lib/private/legacy/app.php(344): OC\Server->getAppManager()

#23 /Applications/MAMP/htdocs/owncloud/lib/private/legacy/app.php(108): OC_App::getEnabledApps()

#24 /Applications/MAMP/htdocs/owncloud/lib/base.php(591): OC_App::loadApps(Array)

#25 /Applications/MAMP/htdocs/owncloud/lib/base.php(1060): OC::init()

#26 /Applications/MAMP/htdocs/owncloud/console.php(74): require_once(’/Applications/M…’)

#27 /Applications/MAMP/htdocs/owncloud/occ(11): require_once(’/Applications/M…’)

#28 {main}192:~ pillo$

Thanks for your help