You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ron Wingfield <Ro...@Archaxis.net> on 2016/03/12 21:14:25 UTC

[users@httpd] Override a File to Same Name in Another Directory

I don’t know if and how this can be accomplished.

Scenario:

Two directories, parent and child.
parent is in a virtual host “container”.
child is a symbolic link to an application default core distribution 
directory (php objects).
./parent/child contains a default config.php file.
./parent contains a custom config.php file.

DocumentRoot points to ./parent/child.

Can the various features of Apache, .htaccess, <Directory>, <File>, 
Alias, etc., be configured to effectively override ./child/config.php to 
./parent/config.php?

In other words, I want to substitute the custom file for the default 
version.  In IBM OS/400 world, this can be easily accomplished with the 
Override with DataBase File command . . .something like:

      OVRDBF FILE(child/config.php) TOFILE(parent/config.php)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Override a File to Same Name in Another Directory

Posted by Ron Wingfield <Ro...@Archaxis.net>.
Actually, I've already grep'ed through the code (grep -r 
"configuration.php" /www/joomla3 > grep.out); found 179 occurrences 
(lines of code).  And as I've mentioned, there are currently 58 
parameters in the configure.php file.  This would be an ambitious 
project.  In consideration that I'm not the author(s) and purveyor of 
the product, and in consideration that every time Joomla issues an 
update or upgrade, then the process would have to be repeated or 
re-integrated into the new version.    For what I think could solve the 
MySQL database "pointer" per virtual host issue, this could be a 
relatively simple hack; however, to accommodate all parameters in the 
configure.php file . . .probably something that should be integrated by 
the authors. Perhaps I should run this suggestion up the Joomla wishlist 
flagpole.  I'm sure it will be warmly received.    ;-)

OTTF, (http://archaxis.net/htdocs/RTWingfield/htdocs/humor/OTTF/OTTF.html)
Ron W.

On 3/13/2016 10:50 AM, Marat Khalili wrote:
>> Why is Joomla designed this way?  Seems that yet another MySQL DB 
>> table could have been designed into the system and the configuration 
>> extracted from the same, rather than reading the content of a 
>> configuration.php file.
> What stops you from implementing configuration.php the way you 
> describe: select parameters set depending on current domain, hard 
> coded or obtained from a database? I'm not saying it'll work for sure, 
> but it's worth a try IMO.
>
> -- 
>
> With Best Regards,
> Marat Khalili
>
> On 13/03/2016 18:25, Ron Wingfield wrote:
>> First, thanks for your quick reply.  I suspected there was no “magic” 
>> in Apache to accomplish my task. My concern is the fact that the 
>> inclusion of configure.php is embedded in the application system, 
>> which by-the-way is . . .Joomla.  Aside from being a totally php 
>> based application (there are no executable binaries, etc.), the 
>> Joomla people will tell you that an “instance” of Joomla does not 
>> support multiple domains. In my opinion, this is a serious design 
>> oversight by omission. What is advertised as a major leading CMS, can 
>> only support one domain.  In other words, Joomla is designed with 
>> only the “bed-room blogger” or “mom-and-pop cupcake bakery” in mind.
>>
>> If your installation is to serve multiple domains, for example a 
>> corporate headquarters with dozens of branch offices where each 
>> branch is semi-autonomous and requires a separate MySQL database, 
>> then this can get ugly.  Each instance of the Joomla core requires 
>> approximately 58MB, not including the MySQL database tables.  The 
>> latter regarding the DB tables is OK because we want to keep the data 
>> segregated . . .easier to backup and restore; however, if you are 
>> serving dozens of branch domains (virtual hosts) where each branch 
>> requires a separate instance of the Joomla core system, the system 
>> objects are redundant . . .parallel systems . . .each requiring 
>> individual attention every time a new “ball is rolled down the 
>> ally”.  This is where a symbolic link to this common core would be/is 
>> practical.  Problem is that a configuration file, 
>> ./joomla3/configure.php, is embedded within the core objects.
>>
>> This configuration file contains about fifty-eight parameters that 
>> include arguments such as
>>
>>    public $sitename = 'Corporate Home Office';
>>    public $db = 'CorpHQ';
>>    public $dbprefix = 'joom_';
>>
>> Alternately, another virtual host could be:
>>
>>    public $sitename = 'Little Rock Branch';
>>    public $db = 'LIT';
>>    public $dbprefix = 'joom_';
>>
>> Why is Joomla designed this way?  Seems that yet another MySQL DB 
>> table could have been designed into the system and the configuration 
>> extracted from the same, rather than reading the content of a 
>> configuration.php file.  Regardless, this configuration file 
>> customizes each instance (virtual host). Were there a way (method) to 
>> create this custom configuration, ./parent(vhost)/configuration.php 
>> and override the ./parent/child(joomla3 default 
>> instance)/configuration.php); then Joomla could easily support 
>> multiple domains with only one instance of the core code.  (By the 
>> way, the MySQL DB table schema exists in 
>> ./installation/sql/mysql/joomla.sql.  Execute [ mysql> ./ joomla.sql 
>> ] to generate the tables; then use phpMyAdmin to change the database 
>> names as appropriate.)
>>
>> Which brings us full-circle to why the need to override the 
>> configuration file.  I have read the Linux document, 
>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/overlayfs.txt 
>> (BTW, I’m working with FreeBSD v10.2), and yes, the “upper” and 
>> “lower” directory scenario does sound analogous to the OS/400 
>> override concepts.  Also keep in mind that OS/400 is not a hierarchal 
>> file system but rather what is described as single level storage.  
>> Analogous to directories are libraries, but all on the same level – 
>> think of taking a roll of pennies(libraries) and scattering them over 
>> the shop floor . . .all at the same level. Paths or search orders to 
>> these libraries are arranged in library lists.  These lists can be 
>> defined by user profiles, job descriptions, etc.  Another way to 
>> avoid the override action is to simply rearrange the library list.  
>> For example, given the following library list:
>>
>>    production-lib
>>    corp-office
>>    branch-1
>>    branch-2
>>    test-lib
>>    programmer-john-lib
>>
>> . . .should programmer John want to test his version of a 
>> configuration file, then he simply moves his library containing the 
>> file to the top of (or up) the list.    . . .sweet!
>>
>> My apologies if this is a little wordy; I still don’t have a 
>> solution, but perhaps this will help others understand the Joomla 
>> task and problems.
>>
>> Thanks again,
>> Ron W.
>>
>>
>> On 3/13/2016 12:57 AM, Marat Khalili wrote:
>>> If you want client requests to http://your.site/config.php be served 
>>> by ./parent/config.php , then the answer is yes -- I'd start with 
>>> mod_rewrite for instance. If config.php is invoked by PHP, not by 
>>> Apache, then you cannot fix it using Apache features -- you really 
>>> need to change that symbolic link or PHP configuration or something 
>>> in the system. Actual analogue of OVRDBF as I understand it in Linux 
>>> is OverlayFS, but it's overkill for your task.
>>>
>>> -- 
>>>
>>> With Best Regards,
>>> Marat Khalili
>>>
>>> On 12/03/2016 23:14, Ron Wingfield wrote:
>>>> I don’t know if and how this can be accomplished.
>>>>
>>>> Scenario:
>>>>
>>>> Two directories, parent and child.
>>>> parent is in a virtual host “container”.
>>>> child is a symbolic link to an application default core 
>>>> distribution directory (php objects).
>>>> ./parent/child contains a default config.php file.
>>>> ./parent contains a custom config.php file.
>>>>
>>>> DocumentRoot points to ./parent/child.
>>>>
>>>> Can the various features of Apache, .htaccess, <Directory>, <File>, 
>>>> Alias, etc., be configured to effectively override 
>>>> ./child/config.php to ./parent/config.php?
>>>>
>>>> In other words, I want to substitute the custom file for the 
>>>> default version.  In IBM OS/400 world, this can be easily 
>>>> accomplished with the Override with DataBase File command . . 
>>>> .something like:
>>>>
>>>>      OVRDBF FILE(child/config.php) TOFILE(parent/config.php)
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Override a File to Same Name in Another Directory

Posted by Marat Khalili <mk...@rqc.ru>.
> Why is Joomla designed this way?  Seems that yet another MySQL DB 
> table could have been designed into the system and the configuration 
> extracted from the same, rather than reading the content of a 
> configuration.php file.
What stops you from implementing configuration.php the way you describe: 
select parameters set depending on current domain, hard coded or 
obtained from a database? I'm not saying it'll work for sure, but it's 
worth a try IMO.

--

With Best Regards,
Marat Khalili

On 13/03/2016 18:25, Ron Wingfield wrote:
> First, thanks for your quick reply.  I suspected there was no “magic” 
> in Apache to accomplish my task. My concern is the fact that the 
> inclusion of configure.php is embedded in the application system, 
> which by-the-way is . . .Joomla.  Aside from being a totally php based 
> application (there are no executable binaries, etc.), the Joomla 
> people will tell you that an “instance” of Joomla does not support 
> multiple domains. In my opinion, this is a serious design oversight by 
> omission. What is advertised as a major leading CMS, can only support 
> one domain.  In other words, Joomla is designed with only the 
> “bed-room blogger” or “mom-and-pop cupcake bakery” in mind.
>
> If your installation is to serve multiple domains, for example a 
> corporate headquarters with dozens of branch offices where each branch 
> is semi-autonomous and requires a separate MySQL database, then this 
> can get ugly.  Each instance of the Joomla core requires approximately 
> 58MB, not including the MySQL database tables.  The latter regarding 
> the DB tables is OK because we want to keep the data segregated . . 
> .easier to backup and restore; however, if you are serving dozens of 
> branch domains (virtual hosts) where each branch requires a separate 
> instance of the Joomla core system, the system objects are redundant . 
> . .parallel systems . . .each requiring individual attention every 
> time a new “ball is rolled down the ally”.  This is where a symbolic 
> link to this common core would be/is practical.  Problem is that a 
> configuration file, ./joomla3/configure.php, is embedded within the 
> core objects.
>
> This configuration file contains about fifty-eight parameters that 
> include arguments such as
>
>    public $sitename = 'Corporate Home Office';
>    public $db = 'CorpHQ';
>    public $dbprefix = 'joom_';
>
> Alternately, another virtual host could be:
>
>    public $sitename = 'Little Rock Branch';
>    public $db = 'LIT';
>    public $dbprefix = 'joom_';
>
> Why is Joomla designed this way?  Seems that yet another MySQL DB 
> table could have been designed into the system and the configuration 
> extracted from the same, rather than reading the content of a 
> configuration.php file.  Regardless, this configuration file 
> customizes each instance (virtual host).  Were there a way (method) to 
> create this custom configuration, ./parent(vhost)/configuration.php 
> and override the ./parent/child(joomla3 default 
> instance)/configuration.php); then Joomla could easily support 
> multiple domains with only one instance of the core code.  (By the 
> way, the MySQL DB table schema exists in 
> ./installation/sql/mysql/joomla.sql.  Execute [ mysql> ./ joomla.sql ] 
> to generate the tables; then use phpMyAdmin to change the database 
> names as appropriate.)
>
> Which brings us full-circle to why the need to override the 
> configuration file.  I have read the Linux document, 
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/overlayfs.txt 
> (BTW, I’m working with FreeBSD v10.2), and yes, the “upper” and 
> “lower” directory scenario does sound analogous to the OS/400 override 
> concepts.  Also keep in mind that OS/400 is not a hierarchal file 
> system but rather what is described as single level storage.  
> Analogous to directories are libraries, but all on the same level – 
> think of taking a roll of pennies(libraries) and scattering them over 
> the shop floor . . .all at the same level. Paths or search orders to 
> these libraries are arranged in library lists.  These lists can be 
> defined by user profiles, job descriptions, etc.  Another way to avoid 
> the override action is to simply rearrange the library list.  For 
> example, given the following library list:
>
>    production-lib
>    corp-office
>    branch-1
>    branch-2
>    test-lib
>    programmer-john-lib
>
> . . .should programmer John want to test his version of a 
> configuration file, then he simply moves his library containing the 
> file to the top of (or up) the list.    . . .sweet!
>
> My apologies if this is a little wordy; I still don’t have a solution, 
> but perhaps this will help others understand the Joomla task and 
> problems.
>
> Thanks again,
> Ron W.
>
>
> On 3/13/2016 12:57 AM, Marat Khalili wrote:
>> If you want client requests to http://your.site/config.php be served 
>> by ./parent/config.php , then the answer is yes -- I'd start with 
>> mod_rewrite for instance. If config.php is invoked by PHP, not by 
>> Apache, then you cannot fix it using Apache features -- you really 
>> need to change that symbolic link or PHP configuration or something 
>> in the system. Actual analogue of OVRDBF as I understand it in Linux 
>> is OverlayFS, but it's overkill for your task.
>>
>> -- 
>>
>> With Best Regards,
>> Marat Khalili
>>
>> On 12/03/2016 23:14, Ron Wingfield wrote:
>>> I don’t know if and how this can be accomplished.
>>>
>>> Scenario:
>>>
>>> Two directories, parent and child.
>>> parent is in a virtual host “container”.
>>> child is a symbolic link to an application default core distribution 
>>> directory (php objects).
>>> ./parent/child contains a default config.php file.
>>> ./parent contains a custom config.php file.
>>>
>>> DocumentRoot points to ./parent/child.
>>>
>>> Can the various features of Apache, .htaccess, <Directory>, <File>, 
>>> Alias, etc., be configured to effectively override 
>>> ./child/config.php to ./parent/config.php?
>>>
>>> In other words, I want to substitute the custom file for the default 
>>> version.  In IBM OS/400 world, this can be easily accomplished with 
>>> the Override with DataBase File command . . .something like:
>>>
>>>      OVRDBF FILE(child/config.php) TOFILE(parent/config.php)
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Override a File to Same Name in Another Directory

Posted by Ron Wingfield <Ro...@Archaxis.net>.
First, thanks for your quick reply.  I suspected there was no “magic” in 
Apache to accomplish my task. My concern is the fact that the inclusion 
of configure.php is embedded in the application system, which by-the-way 
is . . .Joomla.  Aside from being a totally php based application (there 
are no executable binaries, etc.), the Joomla people will tell you that 
an “instance” of Joomla does not support multiple domains. In my 
opinion, this is a serious design oversight by omission. What is 
advertised as a major leading CMS, can only support one domain.  In 
other words, Joomla is designed with only the “bed-room blogger” or 
“mom-and-pop cupcake bakery” in mind.

If your installation is to serve multiple domains, for example a 
corporate headquarters with dozens of branch offices where each branch 
is semi-autonomous and requires a separate MySQL database, then this can 
get ugly.  Each instance of the Joomla core requires approximately 58MB, 
not including the MySQL database tables.  The latter regarding the DB 
tables is OK because we want to keep the data segregated . . .easier to 
backup and restore; however, if you are serving dozens of branch domains 
(virtual hosts) where each branch requires a separate instance of the 
Joomla core system, the system objects are redundant . . .parallel 
systems . . .each requiring individual attention every time a new “ball 
is rolled down the ally”.  This is where a symbolic link to this common 
core would be/is practical.  Problem is that a configuration file, 
./joomla3/configure.php, is embedded within the core objects.

This configuration file contains about fifty-eight parameters that 
include arguments such as

    public $sitename = 'Corporate Home Office';
    public $db = 'CorpHQ';
    public $dbprefix = 'joom_';

Alternately, another virtual host could be:

    public $sitename = 'Little Rock Branch';
    public $db = 'LIT';
    public $dbprefix = 'joom_';

Why is Joomla designed this way?  Seems that yet another MySQL DB table 
could have been designed into the system and the configuration extracted 
from the same, rather than reading the content of a configuration.php 
file.  Regardless, this configuration file customizes each instance 
(virtual host).  Were there a way (method) to create this custom 
configuration, ./parent(vhost)/configuration.php and override the 
./parent/child(joomla3 default instance)/configuration.php); then Joomla 
could easily support multiple domains with only one instance of the core 
code.  (By the way, the MySQL DB table schema exists in 
./installation/sql/mysql/joomla.sql.  Execute [ mysql> ./ joomla.sql ] 
to generate the tables; then use phpMyAdmin to change the database names 
as appropriate.)

Which brings us full-circle to why the need to override the 
configuration file.  I have read the Linux document, 
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/overlayfs.txt 
(BTW, I’m working with FreeBSD v10.2), and yes, the “upper” and “lower” 
directory scenario does sound analogous to the OS/400 override 
concepts.  Also keep in mind that OS/400 is not a hierarchal file system 
but rather what is described as single level storage.  Analogous to 
directories are libraries, but all on the same level – think of taking a 
roll of pennies(libraries) and scattering them over the shop floor . . 
.all at the same level. Paths or search orders to these libraries are 
arranged in library lists.  These lists can be defined by user profiles, 
job descriptions, etc.  Another way to avoid the override action is to 
simply rearrange the library list.  For example, given the following 
library list:

    production-lib
    corp-office
    branch-1
    branch-2
    test-lib
    programmer-john-lib

. . .should programmer John want to test his version of a configuration 
file, then he simply moves his library containing the file to the top of 
(or up) the list.    . . .sweet!

My apologies if this is a little wordy; I still don’t have a solution, 
but perhaps this will help others understand the Joomla task and problems.

Thanks again,
Ron W.


On 3/13/2016 12:57 AM, Marat Khalili wrote:
> If you want client requests to http://your.site/config.php be served 
> by ./parent/config.php , then the answer is yes -- I'd start with 
> mod_rewrite for instance. If config.php is invoked by PHP, not by 
> Apache, then you cannot fix it using Apache features -- you really 
> need to change that symbolic link or PHP configuration or something in 
> the system. Actual analogue of OVRDBF as I understand it in Linux is 
> OverlayFS, but it's overkill for your task.
>
> -- 
>
> With Best Regards,
> Marat Khalili
>
> On 12/03/2016 23:14, Ron Wingfield wrote:
>> I don’t know if and how this can be accomplished.
>>
>> Scenario:
>>
>> Two directories, parent and child.
>> parent is in a virtual host “container”.
>> child is a symbolic link to an application default core distribution 
>> directory (php objects).
>> ./parent/child contains a default config.php file.
>> ./parent contains a custom config.php file.
>>
>> DocumentRoot points to ./parent/child.
>>
>> Can the various features of Apache, .htaccess, <Directory>, <File>, 
>> Alias, etc., be configured to effectively override ./child/config.php 
>> to ./parent/config.php?
>>
>> In other words, I want to substitute the custom file for the default 
>> version.  In IBM OS/400 world, this can be easily accomplished with 
>> the Override with DataBase File command . . .something like:
>>
>>      OVRDBF FILE(child/config.php) TOFILE(parent/config.php)
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Override a File to Same Name in Another Directory

Posted by Marat Khalili <mk...@rqc.ru>.
If you want client requests to http://your.site/config.php be served by 
./parent/config.php , then the answer is yes -- I'd start with 
mod_rewrite for instance. If config.php is invoked by PHP, not by 
Apache, then you cannot fix it using Apache features -- you really need 
to change that symbolic link or PHP configuration or something in the 
system. Actual analogue of OVRDBF as I understand it in Linux is 
OverlayFS, but it's overkill for your task.

--

With Best Regards,
Marat Khalili

On 12/03/2016 23:14, Ron Wingfield wrote:
> I don’t know if and how this can be accomplished.
>
> Scenario:
>
> Two directories, parent and child.
> parent is in a virtual host “container”.
> child is a symbolic link to an application default core distribution 
> directory (php objects).
> ./parent/child contains a default config.php file.
> ./parent contains a custom config.php file.
>
> DocumentRoot points to ./parent/child.
>
> Can the various features of Apache, .htaccess, <Directory>, <File>, 
> Alias, etc., be configured to effectively override ./child/config.php 
> to ./parent/config.php?
>
> In other words, I want to substitute the custom file for the default 
> version.  In IBM OS/400 world, this can be easily accomplished with 
> the Override with DataBase File command . . .something like:
>
>      OVRDBF FILE(child/config.php) TOFILE(parent/config.php)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org