Hej,
Mam problem z uzyskaniem dostepu poprzez PHP do bazy danych. Wszystko dziala na localhoscie z takimi parametrami:
<?php
[ebuild U ] dev-lang/php-5.2.10-r1 [5.2.9-r2] USE=\"apache2 berkdb bzip2 cgi cli crypt curl curlwrappers gd gdbm iconv ipv6 mssql mysql ncurses nls pcre readline reflection session simplexml spl ssl threads truetype unicode xml xmlreader xmlwriter zip zlib -adabas -bcmath -birdstep -calendar -cdb -cjk -concurrentmodphp -ctype -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fastbuild -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd-external -gmp -hash -imap -inifile -interbase -iodbc (-java-external) -json -kerberos -kolab -ldap -ldap-sasl -libedit -mcve -mhash -msql -mysqli -oci8 -oci8-instant-client -odbc -pcntl -pdo -pic -posix -postgres -qdbm -recode -sapdb -sharedext -sharedmem -snmp -soap -sockets -solid -spell -sqlite -suhosin -sybase -sybase-ct -sysvipc -tidy -tokenizer -wddx -xmlrpc -xpm -xsl -yaz (-zip-external%)\" 8,614 kB
[ebuild R ] dev-db/mysql-5.0.83 USE=\"berkdb community perl ssl -big-tables -cluster -debug -embedded -extraengine -latin1 -max-idx-128 -minimal -profiling (-selinux) -static\" 0 kB
?>
Skrypt, poprzez ktory probuje sie dostac wyglada nastepujaco:
<?php
function create_tables($mysql_login, $mysql_password, $mysql_database, $mysql_host)
{
// Polaczenie do bazy danych MySQL
$mysql_connection = @mysql_connect($mysql_host, $mysql_login, $mysql_database) // Gdy polaczenie sie nie powiedzie to wyswietl komunikat i przerwij skrypt
or
die(\"Error while connecting to MySQL -> \".mysql_error().\"\n\"); // Wybor bazy danych
// Gdy wybor bazy danych sie nie powiedzie wyswietl komunikat i przerwij skrypt
or
die(\"Error while selecting database\n\");
echo(\"udalo sie\"); }
/*--------------------------------------------------------------------------------------------------------------------------*/
create_tables('login', 'haslo', 'nazwa_bazy', 'localhost');
?>
Gdy loguje sie do MySQL-a poprzez linie komend wszystko jest okej
<?php
michasss
@laptop ~ $
mysql -u michasss
-p
Enter password:
Welcome to the
MySQL monitor
. Commands
end with
; or g
.Your
MySQL connection id is
16Server version: 5.0.83-log Gentoo Linux mysql-5.0.83
Type
'help;' or
'h' for help
. Type
'c' to clear the
current input statement
.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| michasss |
+--------------------+
2 rows in set (0.00 sec)
mysql>
?>
Moje jest jakas "specjalna" opcja w php.ini albo my.conf ktora musze dopisac / zaznaczyc / odznaczyc ? Prosze o pomoc, pozdrawiam Michal
Ten post edytował MiChaSSs 11.07.2009, 15:55:53