Re: Intercepting fopen, mysql_connect, and similar functions for migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Unless you want to install the run-kit extension [shudder] you cannot
do that.

Fix the code.

On Fri, June 8, 2007 8:42 pm, Kelly Jones wrote:
> 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
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux