While the file will be parsed by PHP, you have nothing to worry about, and it is no more secure than the other. However, there is practicality: if you write mysql_connect in more than one place and you decide to move your database to another host, or you decide to change the password, or if you find it is absolutely insecure to connect using the root account (change this;)), it is easier to have a connect statement in one place.
In addition, if PHP does not parse your file, you are better off having these critical files outside the website, even inaccessible to Apache. This is the safest way.
source share