Triger a popup by PHP

Is there a way to trigger a popup window by PHP?
i know it is possible by JS but it can’t help beacuse i need to check a value in database and then display the popup.
I used the following code but didn’t help:

<?php
echo '<script> bricksOpenPopup(4499);</script>';
?>