I'm migrating a website from one server to another, and my file paths
and dbs have changed.

For example /a/b/c/foo.txt on the old machine is at /x/y/z/foo.txt on
the new machine. The MySQL db "foo" on the old machine is "bar" on the
new machine.

Can I intercept fopen() and mysql_connect() so that when PHP does
fopen("/a/b/c/foo.txt"), I magically (using Zend functions or method
overloading or anything else) convert it at runtime to
fopen("/x/y/z/foo.txt").

Same thing so that mysql_connect("foo") becomes mysql_connect("bar").

The code is badly written: doing a search/replace in the code wouldn't
really work. I really want to "hook" fopen()/mysql_connect() and
similar commands so I can tweak their args before they actually
execute. Is there any hope?

Sort of like an LD_PRELOAD for PHP?

--
We're just a Bunch Of Regular Guys, a collective group that's trying
to understand and assimilate technology. We feel that resistance to
new ideas and technology is unwise and ultimately futile.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to