Yes, you can include the connection string from a file not under the web server's root. Take a look at the output of a php file with the single phpinfo() command in it, and note the include path.
On my workstation, it's:
.:/usr/local/lib/php
which means . (the current directory) AND /usr/local/lib/php are the two places, so my workstation I could put connection.inc into /usr/local/lib/php and no one will be able to view it from the web server front end.
Also, you can use a file extension like .inc and then tell apache not to serve that extension, like so:
<Directory /www>
<Files "*.inc">
Order Deny,Allow
Deny from all
</Files>
more directives we don't care about go here.
</Directory>