|
Posted by Rik on 08/17/07 14:32
On Fri, 17 Aug 2007 16:11:33 +0200, Jerim <wyount@gmail.com> wrote:
> I am attempting to put together one script that pulls data from one
> database on its own server, and data from another database on its own
> server, which is off-site.
>
> Server 1 - Only allows shared memory access to the database. Also
> disallows http:// includes. This is where the database of names is
> stored. This is our internal MySQL server.
>
> Server 2 - Only allows shared memory access to the database. So
> anything that calls the connection has to be on the same server. This
> is our external web server maintained by an outside party.
>
> To get a list of names, I created a PHP page on Server 2 that simply
> includes a script from Server 1. The script on Server 1 connects to
> the database, runs the query and prints the names to the screen. I did
> this, because we wanted the web page on our web server which is Server
> 2, but since the the MySQL on Server 1 only accepts shared memory
> access, the script that called it had to be on the same server.
>
> Now what I want to do is include the ages of each person. That is
> information stored in a MySQL database on Server 2, the web server. I
> can't modify the Script on Server 1 to include the database connection
> on Server 2 since Server 2 also requires shared memory access. So I
> tried putting an include file on Server 2 and calling it from Server
> 1, but Server 2 doesn't allow http:// includes.
>
> Please keep in mind that I have had problems with the include. You
> would think that being an include file, it would have access to all
> the data on the page that called it. I have found this not to be the
> case. The include script that I called, did not recognize variables
> that were declared in the file that was calling it. Perhaps because it
> was on another server?
Indeed.
> The only solution I could find was to pass the
> variables to the include file through URL. So if I were to put another
> include statement on the original page on Server 2, the off site
> include doesn't have access to that database connection. Any help is
> appreciated.
Hmmms, it seems there's an epedemic of people including by HTTP (search
the recent archive of this group). While you can include the _output_ of
an php file by HTTP, a 'real' include, which will recognize your variables
can only be done using either the local filesystem or by including raw PHP
code from elsewhere instead of the result.
The fact that these 2 servers can hardly communicate is a real problem.
You'll either have to get the output data and link it to age 'manually'
with PHP, or you'll have to really think about the database(server) setup.
Preferably all related data on one server, possibly a master/slave
scenario.
--
Rik Wasmus
Navigation:
[Reply to this message]
|