Question: I am trying to read an external file, hosted on another server, but am having issues.

Here, I identify the variables:

```
$variable1 = "test";
$variable2 = "testing";

```

Here, I identify the URL to read:

```
$url = "http://test.com/page.php?v1=" . $variable1 . "&v2=" . $variable2;

```

Here, I read the external file:

```
$content = file($url);
$reading = $content[0];
echo $reading;

```

The odd thing is nothing comes out. I have tried entering the actual URL and it does work, however, when PHP tries to do it, it comes out blank.

I know it is not a fatal error as I tried just putting some regular text in there. So,there is something wrong that just is not reading the file correctly. Furthermore, I did make sure the reading server is no blocked by the server with the file on it.

Any suggestions would be appreciated.

Answer: 
Smarmy answer first. Yes you can. It's called the database ;-)

Seriously though, Apache + PHP (without anything else) is not the best option if you're trying to persist values across requests. Normally, if that type of functionality is needed, it is done through either a hard file or a database connection which is refreshed every time a request is triggered. Obviously neither of those are sufficient to persist an entirely separate connection.

The general rule is one request one connection. There are ways to persist connections so that this number is lowered but `pg_connect` which was supposed to be a canonical way to approach this problem, seems to be incredibly broken. You may wish to look into [`pgbouncer`](http://pgfoundry.org/projects/pgbouncer/) or [`pgpool`](http://pgpool.projects.postgresql.org/) instead. I don't know how the PDO driver handles `ATTR_PERSISTENT` for Postgre.
The need to connect to a DB frequently is a common feature of web applications written in PHP, which is why the oci\_pconnect() function uses a persistent cache of connections that can be re-used across different script/page requests (so the DB connection overhead is paid only once per Apache child or PHP process) - see [PHP DB connection handling](http://www.php.net/manual/en/oci8.connection.php)

Is there any particular reason why you *want* to do the work of managing a DB connection pool yourself? If you're absolutely Hell-bent on this idea, then you *could* use something like a shared memory segment to store data objects that are to be shared across processes - but then you need a mutex system to avoid death by race condition when modifying the shared data, a "watchdog" to clean things up when a process dies without properly releasing a mutex, etc.