configuring the 3rdparty config file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

configuring the 3rdparty config file

Post 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
User avatar
manohoo
Forum Contributor
Posts: 201
Joined: Wed Dec 23, 2009 12:28 pm

Re: configuring the 3rdparty config file

Post 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.
Post Reply