 | |
06-06-2003, 02:22 PM
|
#1 (permalink)
| | Registered User
Join Date: Dec 2002 Location: Fayetteville, NC
Posts: 1,237
| » 
PostGre Support in PHP
I am trying to setup Postgre so I can test a few database files. I have it setup correctly but, how do I configure it for php usage? Thanks. |
| |
06-21-2003, 07:23 PM
|
#2 (permalink)
| | Registered User
Join Date: Dec 2002 Location: Fayetteville, NC
Posts: 1,237
|
Bump. Plz I am sure somebody has to use Postgre.
|
| |
06-21-2003, 07:32 PM
|
#3 (permalink)
| | Banned
Join Date: Oct 2001
Posts: 447
|
I haven't, but you don't need to configure Postgre, you need to connect through PHP. Quote:
<?php
$dbconn = pg_connect ("dbname=mary");
//connect to a database named "mary"
$dbconn2 = pg_connect ("host=localhost port=5432 dbname=mary");
// connect to a database named "mary" on "localhost" at port "5432"
$dbconn3 = pg_connect ("host=sheep port=5432 dbname=mary user=lamb password=foo");
//connect to a database named "mary" on the host "sheep" with a username and password
$conn_string = "host=sheep port=5432 dbname=test user=lamb password=bar";
$dbconn4 = pg_connect ($conn_string);
//connect to a database named "test" on the host "sheep" with a username and password
?>
| |
| |
06-21-2003, 08:02 PM
|
#4 (permalink)
| | Registered User
Join Date: Dec 2002 Location: Fayetteville, NC
Posts: 1,237
|
Well, I installed Postgre and was going to setup phpbb on it and it said that php wasn't configured to support an installation with PostGre.
|
| |
06-22-2003, 08:48 PM
|
#5 (permalink)
| | Banned
Join Date: Oct 2001
Posts: 447
| Quote: |
Well, I installed Postgre and was going to setup phpbb on it and it said that php wasn't configured to support an installation with PostGre.
| what said what wasn't installed properly???
regardless, can you access Postgre DB through any client? http://www.phpbb.com/
as you are using their product, ask them?
I could be wrong, but PHP just app server, no special configs needed to access:
mysql,
Access,
ASA, sqlanywhere.
Haven't tried Oracle/DB2/SQLServer, but sure PHP can access them rather easily.
Sorry I can't help more.
|
| |
07-11-2003, 01:52 AM
|
#6 (permalink)
| | Registered User
Join Date: Oct 2001 Location: Yuma, AZ
Posts: 2,484
|
PHP is just like any application. I can be compiled with or without support for certain programs. In the earlier vers of PHP, MySQL was by default enabled (this has changed. You must enable it yourself now). PostgreSQL was optional. You had to recompile PHP to add Postgres. On FreeBSD this is very easy to do.
cd /usr/ports/www/mod_php4
make distclean
make (choose postgres at option screen)
make install
I haven't done this on anothe other *nix box. I think you'll just have to grab the source and compile it with make -with-pgsql (after configure of course).
HTH (Hope This Helps)
-Praetorian
|
| |
07-13-2003, 09:43 PM
|
#7 (permalink)
| | Banned
Join Date: Oct 2001
Posts: 447
| Quote: |
PHP is just like any application. I can be compiled with or without support for certain programs.
| Sure, we all recompile outlook to use different mailservers!
I had to recompile notepad so it could read *.java/*.html/*.css files!
PHP is app server.
postgree is DB server.
All versions of PHP (3+) I have used, already support mySQL and postgre, plus more... No need to recompile, much less reconfigure (some PHP settings may improve performance). If you can get PHP working properly thru web server, PHP working.
The DB is similar. You install and (maybe)configure DB, then access thru web server, or other client. Then DB working.
You get the above 2, PHP can access postgre DB.
phpbb is not an application, just PHP BB scripting package, that uses apps:
PHP
web server
DB server
and that(phpbb) where problem of post lies.
|
| |
07-15-2003, 08:11 PM
|
#8 (permalink)
| | Registered User
Join Date: Oct 2001 Location: Yuma, AZ
Posts: 2,484
|
PHP is a scripting language, not an application. It is interpreted by Apache in the form of a module, and the language itself is very modular. Just like any Unix program, you can add or remove features. The default version of mod_php4 on FreeBSD 5.0 does not have PostgreSQL compiled in. You have to compile it yourself (the same is not true on Debian Woody). I'm assuming this may be the issue with whatever version of *nix embj is running on. Qball, please get more information about each Distro/OS and it's features before you go saying that a particular application contains support that it does not, by default.
Also, PostgreSQL is a relational database management system, not database server.
Last edited by Praetorian; 07-15-2003 at 08:35 PM.
|
| |
07-15-2003, 10:08 PM
|
#9 (permalink)
| | Banned
Join Date: Oct 2001
Posts: 447
| Quote: |
PHP is a scripting language, not an application. It is interpreted by Apache...
| what? if I have just Apache, can I 'execute' a PHP script? Quote: |
PostgreSQL is a relational database management system, not database server.
| define, exactly:
database management system
database server
what does each do?
=== http://www.postgresql.org/
"PostgreSQL, the worlds most advanced Open Source database software"
DBMS?
|
| |
07-15-2003, 10:41 PM
|
#10 (permalink)
| | Registered User
Join Date: Oct 2001 Location: Yuma, AZ
Posts: 2,484
| Quote: |
what? if I have just Apache, can I 'execute' a PHP script?
| I also said in the form of a module. I'm not sure where that part got left out.
"PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly." - PHP web site
mod_php4 = PHP Apache module on FreeBSD. PHP is separate from Apache. You need PHP installed on your system, and loaded by Apache before you can execute a PHP script on your web server. Quote:
define, exactly:
database management system
database server
what does each do?
| Hmm...I've never seen any major DB refered to as a database server. I would call an database management system the database software that runs on a server. I would call a database server the computer on which the database software runs. Where do you see this? I see:
"PostgreSQL : The most advanced Open Source database system in the world"
on http://advocacy.postgresql.org/about/.
PostgreSQL is a RDBMS (Relational Database Management System).
Last edited by Praetorian; 07-15-2003 at 10:44 PM.
|
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | Most Active Discussions  | | | | | Recent Discussions  | | | | | |