Re: Include problems
| From: | Daniel Brown | Date: | Mon, 14 Apr 2008 18:15:29 +0000 |
| Subject: | Re: Include problems | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-272983@lists.php.net to get a copy of this message | ||
On Sat, Apr 12, 2008 at 11:06 PM, Bojan Tesanovic <btesanovic@gmail.com> wrote:
>
> On Apr 12, 2008, at 8:28 AM, GoWtHaM NaRiSiPaLli wrote:
>
>
> > if(file_exists("../common/config.ini")) {
> > $configData = parse_ini_file("../common/config.ini");
> > } else {
> >
>
>
> Try changing above code so it reads
>
>
> if(file_exists("common/config.ini")) {
> $configData = parse_ini_file("common/config.ini");
> } else {
In your primary file, you could also consider adding:
<?php
$base_path = dirname(__FILE__);
?>
And then, all includes from within that file would be included as such:
<?php
include($base_path.'/common/config.ini');
?>
Finally, on a different note, it may not be in your best interest
to keep a .ini extension on a configuration file, since this is
generally readable on the web.
--
</Daniel P. Brown>
Ask me about:
Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo.,
and shared hosting starting @ $2.50/mo.
Unmanaged, managed, and fully-managed!