Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!

Ogłoszenie

Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.

#1  2006-11-05 17:48:45

  Rumi - prawiczek erotoman

Rumi
prawiczek erotoman
Skąd: Gorlice
Zarejestrowany: 2004-09-23
Serwis

postgresql + php [Solved by bercik]

nie wiem cyz to ja coś źle zrobiłem bo omało jest na ten temat na pl www poza algorytmy.pl ale nei będ epłacił za przegladanei ich strony. php5-pgsql mam skrypt z uczelni


<html>
<?
$conn=pg_connect("host=127.0.0.1 port=5561 user=user dbname=baza");
$sql="select * from student";
$res=pg_Exec($sql);
while($data=pg_fetch_row($res)){
print "<tr><td>";
print "<br>";
print join("<td>", array($data[0]," ", $data[1]," ", $data[2]," ", $data[3]," "));
}
pg_close($conn);
?>
</html>

baza jest rekordy tysz port zmieniłem na 5432 w skrypcie. Myślałem że to z powodu tego że mam php5 a tu http://pl.php.net/pgsql pisze ze np pg_exec() w pph5 to pg_query(), neistety to też nei to:


Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: FATAL: IDENT authentication failed for user "rumi" in /home/rumi/public_html/index.php on line 3

Warning: pg_query() [function.pg-query]: No PostgreSQL link opened yet in /home/rumi/public_html/index.php on line 5

Warning: pg_fetch_row() expects parameter 1 to be resource, boolean given in /home/rumi/public_html/index.php on line 6

Warning: pg_close(): supplied argument is not a valid PostgreSQL link resource in /home/rumi/public_html/index.php on line 11

co do 1 linijki to też nei wiem oco mu chodzi w pg_hba.conf odhaszowane jak na zajęciach jeszcze moze mój php.ini


;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;   extension=modulename.extension
;
; For example, on Windows:
;
extension=msql.dll
;
; ... or under UNIX:
;
extension=msql.so
;
; Note that it should be the name of the module only; no directory information
; needs to go here.  Specify the location of the extension with the
; extension_dir directive above.


; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.

;extension=php_mbstring.dll
;extension=php_bz2.dll
;extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_filepro.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_ifx.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
;extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_mssql.dll
;extension=php_msql.dll
extension=php_mysql.so
;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_oracle.dll
extension=php_pgsql.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_sockets.dll
;extension=php_sqlite.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
...
[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
mysql.max_links = -1

; Default port number for mysql_connect().  If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
; at MYSQL_PORT.
mysql.default_port =

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
mysql.default_password =

; Maximum time (in secondes) for connect timeout. -1 means no limit
mysql.connect_timeout = 60

; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
; SQL-Errors will be displayed.
mysql.trace_mode = Off

[MySQLi]

; Maximum number of links.  -1 means no limit.
mysqli.max_links = -1

; Default port number for mysqli_connect().  If unset, mysqli_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
; at MYSQL_PORT.
mysqli.default_port = 3306

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysqli.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysqli.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysqli.default_user =

; Default password for mysqli_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
mysqli.default_pw =

; Allow or prevent reconnect
mysqli.reconnect = Off

[mSQL]
; Allow or prevent persistent links.
msql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
msql.max_persistent = -1

; Maximum number of links (persistent+non persistent).  -1 means no limit.
msql.max_links = -1

[PostgresSQL]
; Allow or prevent persistent links.
pgsql.allow_persistent = On

; Detect broken persistent links always with pg_pconnect().
; Auto reset feature requires a little overheads.
pgsql.auto_reset_persistent = On

; Maximum number of persistent links.  -1 means no limit.
pgsql.max_persistent = -1

; Maximum number of links (persistent+non persistent).  -1 means no limit.
pgsql.max_links = -1

; Ignore PostgreSQL backends Notice message or not.
; Notice message logging require a little overheads.
pgsql.ignore_notice = 0

; Log PostgreSQL backends Noitce message or not.
; Unless pgsql.ignore_notice=0, module cannot log notice message.
pgsql.log_notice = 0

[Sybase]
; Allow or prevent persistent links.
sybase.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
sybase.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
sybase.max_links = -1

;sybase.interface_file = "/usr/sybase/interfaces"

; Minimum error severity to display.
sybase.min_error_severity = 10

; Minimum message severity to display.
sybase.min_message_severity = 10

; Compatability mode with old versions of PHP 3.0.
; If on, this will cause PHP to automatically assign types to results according
; to their Sybase type, instead of treating them all as strings.  This
; compatibility mode will probably not stay around forever, so try applying
; whatever necessary changes to your code, and turn it off.
sybase.compatability_mode = Off

No i uwaga taak że od momentu inst php5-pgsql wyłączyłą si eobsługa dla MySQL :/


... ktoś pomoże ?

Offline

 

#2  2006-11-05 21:46:41

  bercik - Moderator Mamut

bercik
Moderator Mamut
Skąd: Warszawa
Zarejestrowany: 2006-09-23
Serwis

Re: postgresql + php [Solved by bercik]

nie wiem jak dla postgresql ale dla mysql duza roznica bylo to czy piszesz 127.0.01 czy localhost (musialo byc leksykalnie to samo co w konfigu mysql)


"Wszyscy wiedzą, że czegoś zrobić nie można. Ale przypadkowo znajduje się jakiś nieuk, który tego nie wie. I on właśnie robi odkrycie." (A.Einstein)

Offline

 

#3  2006-11-06 07:59:17

  Rumi - prawiczek erotoman

Rumi
prawiczek erotoman
Skąd: Gorlice
Zarejestrowany: 2004-09-23
Serwis

Re: postgresql + php [Solved by bercik]

nie wiem jak dla postgresql ale dla mysql duza roznica bylo to czy piszesz 127.0.01 czy localhost (musialo byc leksykalnie to samo co w konfigu mysql)

szok rusyzło :] thx nawet z pg_Exec

Offline

 

Stopka forum

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson
Możesz wyłączyć AdBlock — tu nie ma reklam ;-)