Page 1 of 1

configuring the 3rdparty config file

Posted: Wed Dec 30, 2009 4:55 am
by PHPycho
Hello forums!!

I need your suggestion in the following case.

I have some 3rdparty script which have its own configuration file(say config.php) for db settings, folder dir, base url etc.
I want to use it my framework and want to use the framework Db settings, folder settings, url settings to the 3rd party config file.

Generally 3rd party has some folders and generally includes the config.php file @ the top.
for example: 3rdparty/libs/someapplication.php

Code: Select all

<?php
include('../includes/config.php');
.......
What i want is: i want to include my framework config file @ the top so that i can re-use the variables.

For example:
3rdparty/includes/config.php

Code: Select all

<?php
include('../../my_framwork_includes/config.php');
//use framework settings here...
....

and will be using this config.php to 3rdparty application files.

This works only for application files under 3rdparty/libs/... but wont work if the files are in the base or some other nested folder and the reason is obvious.

How to deal in such case so that the 3rdparty/includes/config.php file can be used along with the framework config vars.

Thanks in advance for the valueable suggestion.
Regards

Re: configuring the 3rdparty config file

Posted: Wed Dec 30, 2009 11:12 am
by manohoo
In Windows I use "include_path = ".;c:\wamp\includes" but it DOESN'T apply to subdirectories. I ran into a similar problem as yours, I ended up specifying a few subdirectories in the include_path variable.

In PHP.ini

Code: Select all

;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
include_path = ".;c:\wamp\includes"
include_path = ".;c:\wamp\includes\subdirectory1"
include_path = ".;c:\wamp\anotherplace\subdirectory2"
 
As an alternative you could use Apache's <Files> directive, since any directives apply to subdirectories as well.