I've been quite successful so far. However, the instruction above is to enable web applications to access postgreSQL database on the same machine. Apache, PHP, and postgreSQL are indeed compiled on the same machine.
Code: Select all
Web Server
================
| |
| Apache |
| + |
| PHP |
| + |
| postgreSQL |
| server |
| |
================
Figure 1: Apache, PHP, and postgreSQL on the same machine
However, is it possible to compile Apache and PHP to access postgreSQL database on remote database server? I'm thinking about the following configuration:
Code: Select all
Web Server Database Server
================ ================
| | | |
| Apache | | |
| + |--------| postgreSQL |
| PHP | | server |
| | | |
================ ================
Figure 2: Apache and PHP accessing remote postgreSQL database: is it possible?
I wonder if such configuration above is possible, because from what I read from the instruction, it seems that PHP needs certain postgreSQL libraries to be installed anyway, in order for the web applications to access postgreSQL database.
Note that I'm just a newbie; I merely guess from the following compilation steps:
(1) From the two steps below, it seems to me that certain postgreSQL libraries need to be shared (correct me if I'm wrong).
3. Append the following line to /etc/ld.so.conf:
/usr/local/pgsql/lib
4. Run the dynamic linker:
ldconfig -v
(2) And then, PHP need to be compiled in certain way to access the shared postgreSQL libraries (emphasizes mine):
Configure PHP with Apache and PostgreSQL in mind:
./configure --with-apache=/usr/local/src/apache_1.3.12
--with-pgsql=share
--enable-track-vars
So the ultimate question is: do I really need to compile postgreSQL on my web server, despite the it is to access remote postgreSQL database anyway? Ergo, do I need to have the following configuration?
Code: Select all
Web Server Database Server
================ ================
| | | |
| Apache | | |
| + | | |
| PHP |--------| postgreSQL |
| + | | server |
| postgreSQL | | (production) |
| server | | |
| (unused) | | |
| | | |
================ ================
Figure 3: the postgreSQL database on the web server is effectively unused, because it is only compiled simply because PHP needs it
Based on the instruction I mentioned, it seems that I need to compile postgreSQL server on the web server anyway, simply because PHP needs its library. However, I don't quite like the configuration, because the postgreSQL server on the web server is unused anyway; the production database is the one on the remote database server.
Alternatively, if PHP really needs postgreSQL libraries to access a postgreSQL database (remote or otherwise), can I just compile the postgreSQL client on the web server? Can I have the following configuration?
Code: Select all
Web Server Database Server
================ ================
| | | |
| Apache | | |
| + | | |
| PHP |--------| postgreSQL |
| + | | server |
| postgreSQL | | (production) |
|(client-only) | | |
| | | |
================ ================
Figure 4: is it possible?
Is it possible to do the above configuration? If I compile postgreSQL client, will it include the libraries required by PHP? And where to find compiling instruction for postgreSQL client only?
And how about MySQL? Is it possible to have Apache and PHP to access remote MySQL database?