Reply to Re: Migrating to a new server: how to map one directory to another

Your name:

Reply:


Posted by Jerry Stuckle on 11/04/05 21:40

JDS wrote:
> Hi all. I don't know if this is possible, and if it is, whether it needs
> to be done within Apache configuration or PHP configuration, but here goes:
>
> I am migrating my web server to another machine. In fact, it is two
> machines -- one for the web server itself, and one as a data server for
> user home directories and MySQL.
>
> The users' home dirs will be mounted on the web server as NFS mounts.
>
> Now, the original, current, configuration has user home directories in
> /home/*. There are a number of PHP scripts that refer to this directory
> by an absolute path, for example, with lines like:
>
> <? include("/home/webmaster/public_html/include/thing.inc"); ?>
>
> However, the NFS mounted home directories are mounted on /webusers. This
> is because I was reserving /home for actual local user directories.
>
> Is there a way I can map calls to "/home" to "/webusers" without actually
> changing all of the places that such absolute-path calls exist?
>
> Note that a symbolic link from /home->/webusers wil not work because /home
> is a real, existing, local directory.
>
> System details:
> old server: Red Hat Linux 9, Apache 1.3.x, PHP 4.3.x, MySQL 3.23.x
>
> new server(s):
> web: RHEL 4, Apache 2.0.x, PHP 4.3.x
> data: RHEL 4, MySQL 4.1.x
>
> I can post any more details as requested, of course.
>
> Thanks!
>

First of all, you should be using:

include ($_SERVER['DOCUMENT_ROOT']) . '/include/thing.inc');

Then if you change to another server or otherwise move your Apache
document_root you don't need to change all of your include statements.

As for the rest of the question, there's no way I can think of. And
Apache alias for the directory would not affect PHP include statements.

Since you can't create the symlink I think you're stuck with changing
all of your include statements.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация