How does yii2 or other php frameworks internally manage mysql connections?

     

How does a typical php framework instantiate db classes?  If I do: $db->connect();


Does this maintain a single object through out ?  If yes how does it handle multiple http requests on apache which need mutiple queries and updates in the db?


If not Doesnt it cause memory issues? If there is a new object created for every apache process?


PS: I know this sounds duplicate. But I only wanted to understand in terms of php.