If it can be useful to someone, the problem is determined by the server-side cache: It seems that the output of the installation script is cached before the page is properly loaded. I have disabled the dynamic caching by adding the following code to the .htaccess file:
Header set Cache-Control "max-age=0,no-store"
Once I did that the installation page started timing out as was taking too long to respond and reached some of the predefined limitations on the server. To solve that, I went ahead and increased the dynamic timeout by adding the