Вы находитесь на странице: 1из 8

PHP MYSQL

: .. (glsv)
e-mail: glsv@yandex.ru
,
PHP
MySQL.
MySQL, PHP Apache. ,
, ,
.
Apache PHP
:
Apache2.2 PHP-5.1.4
Apache, PHP, MySQL
, MySQL (
php_mysql.dll) PHP
.
php.ini
c:/windows/system32.

1. PHP (Apache) php.ini (


Apache 2.x)
Apache 2 ,
Apache (httpd.conf)
PHPIniDir,
php.ini. Apache
, .
PHPIniDir c:/php

,
/, Windows,
\\. , Apache PHP
unix-,
. -

Apache PHP
unix-.

, php.ini
c:/php. ,
Apache php.ini
phpinfo().

PHP

<?php
echo phpinfo();
?>

Configuration File (php.ini) Path.
php.ini, .
, , Apache
php.ini.
C:/php/php.ini // php.ini
C:/windows/ // php.ini

Apache PHPIniDir
,
php.ini. Apache
1.3 php.ini
Windows, : c:/Windows.
PHPIniDir Apache 2
.
, , Apache
php.ini
MySQL.

2. PHP.INI extension_dir
extension_dir ,
php,
php_mysql.dll. php
c:/php, , ,
ext (c:/php/ext).
extension_dir.
extension_dir = "c:/php/ext"

3. MySQL
php.ini :
;extension=php_mysql.dll
.
extension=php_mysql.dll

4. libmysql.dll
c:/windows
PHP Apache ,
MySQL
libmysql.dll c:/php
c:/windows/system32. php Apache,
CGI-,
.

5. Apache

Apache.

6.
, MySQL
PHP phpinfo().
MySQL.
, ,
.

PHP c MySQL

1. MySQL.
, PHP c MySQL
, MySQL . ,
Windows: |
CONTROL PANEL | |
ADMINISTRATION TOOLS SERVISES.
MySQL ,
( ).
, MySQL :
Crtl + Alt + Del
mysqld.exe. mysqld.exe
: mysqld-nt.exe, mysqld-max-nt.exe,
mysqld-debug.exe.

2. php-

PHP-, PHP
MySQL

<?php
$dblocation = "127.0.0.1";
$dbname = "test";
$dbuser = "root";
$dbpasswd = "";

$dbcnx = mysql_connect($dblocation, $dbuser, $dbpasswd);


if (!$dbcnx)
{
echo "<p> , mySQL</p>";
exit();
}
if (!mysql_select_db($dbname,$dbcnx) )
{
echo "<p> , </p>";
exit();
}
$ver = mysql_query("SELECT VERSION()");
if(!$ver)
{
echo "<p> </p>";
exit();
}
echo mysql_result($ver, 0);
?>
,
MySQL. ,
.

MySQL

: Call to undefined function


Call to undefined function
, PHP.
MySQL, ,
PHP MySQL php_mysql.dll
:
Fatal error: Call to undefined function mysql_connect()
in C:\www\panel\htdocs\test.php on line 7
.

MySQL phpinfo()
, MySQL
MySQL
phpinfo(), libmysql.dll,
c:/windows/system32.
1. libmysql.dll,
c:/windows/system32 ,
PHP. .
2. libmysql.dll c:/windows
.
,
c:/php.

libmysql.dll
MySQL. ,
c:/windows/system32
MySQL, PHP .
libmysql.dll
c:/windows/system32 MySQL.
PHP
.


PHP c MySQL
,
. php-,
, @
mysql_connect() mysql_select_db().
.

,
, ..
.

PHP-, PHP
MySQL

<?php
$dblocation = "127.0.0.1";
$dbname = "test";
$dbuser = "root";
$dbpasswd = "";

$dbcnx = @mysql_connect($dblocation, $dbuser, $dbpasswd);


if (!$dbcnx)
{
echo "<p> , mySQL</p>";
exit();
}
if (!@mysql_select_db($dbname,$dbcnx) )
{
echo "<p> , </p>";
exit();
}
$ver = mysql_query("SELECT VERSION()");
if(!$ver)
{
echo "<p> </p>";
exit();
}
echo mysql_result($ver, 0);
?>

, , , , PHP
php_mysql.dll.
.
1. , PHP-,
MySQL.
2. @ mysql_connect
mysql_select,
.
,
.

: Can't connect to MySQL server on '127.0.0.1' (10061)


php-
:
Warning: mysql_connect() [function.mysql-connect]:
Can't connect to MySQL server on '127.0.0.1' (10061)
in C:\www\panel\htdocs\test.php on line 7
,
MySQL.
1 PHP c MySQL.

: Access denied for user 'root'@'localhost' (using


password: YES)
:
Warning: mysql_connect() [function.mysql-connect]:
Access denied for user 'root'@'localhost' (using password: YES)
in C:\www\panel\htdocs\test.php on line 7
,
MySQL c .
$dbpasswd .
MySQL root.
root ,
$dbpasswd .
PHP

Apache, PHP
http://www.softtime.ru/forum/index.php?id_forum=5 .