How do I find the web root in civicrm.settings.php?
The easiest way to set those is using Civi::settings()->set('......').

In the UI it is Administer/System Settings/Directories.

Is that what you are looking for?