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

-

MySQL 5.5.23
PHP 5.3.10
Apache HTTP Server 2.2.22
phpMyAdmin 3.5.0


, Windows XP,
, ,
, -: Apache, MySQL, PHP phpMyAdmin.

2009-2011

, ,
HTML, ,
? , HTML
.
.
? , HTML , ,
. JavaScript, CSS, DHTML XML.
PHP,
. ,
MySQL -.
,
.
,
. , ,
Windows XP, , - Apache,
Unix , ,
.
,
, ,
,
-. .


:

, .
.
"/", "\",
Windows ( Unix
).

MySQL 5.5.23
: http://www.mysql.com/
: http://dev.mysql.com/doc/
: http://www.mysql.com/downloads/mysql/
: mysql-5.5.23-win32.msi
"Windows (x86, 32-bit), MSI Installer" .


, - .

"Custom".

MySQL .

- "Detailed Configuration".

"Developer Machine". ? :)

"Multifunctional Database", InnoDB (


), MyISAM ( , ).

InnoDB.


MySQL. "Decision Support (DSS)/OLAP",
,
.

"Enable TCP/IP Networking" TCP/IP ,


. MySQL 3306.
"Enable Strict Mode", SQL (
).
6

. "Manual Selected Default


Character Set / Collation" "cp1251" ,
Cyrillic Windows (cp1251),
.

"Install As Windows Service", ,


. , , . ,
"Launch the MySQL Server automatically",

-
. "Include Bin Directory in Windows PATH" -
"bin", .

- "root". . , ,
.

-
"Write configuration file",
MySQL - "my.ini", ,
.

"my.ini".
1) [client], :
port=3306
:
character-sets-dir="C:/Program Files/MySQL/MySQL Server 5.5/share/charsets"
2) [mysqld], :
port=3306
, ,
MySQL:
character-sets-dir="C:/Program Files/MySQL/MySQL Server 5.5/share/charsets"
init-connect="SET NAMES cp1251"
3) , :
default-storage-engine=INNODB
MYISAM:
default-storage-engine=MYISAM
"my.ini".
MySQL .

PHP 5.3.10
: http://www.php.net/
(VC9 x86 Thread Safe, Zip ): http://windows.php.net/download/
: php-5.3.10-Win32-VC9-x86.zip
.chm,
: php_enhanced_ru.chm
( "C:\php").
- "php.ini-development"
( ), "php.ini"
.
php.ini
1) :
post_max_size = 8M
16 POST, :
post_max_size = 16M
2) :
;include_path = ".;c:\php\includes"
, . ( !
):
include_path = ".;c:\php\includes"
"C:\php\includes", .
3) :
extension_dir = "./"
:
extension_dir = "C:/php/ext"
4) :
;upload_tmp_dir =
:
upload_tmp_dir = "C:/php/upload"
"C:\php\upload", HTTP.
5) :
upload_max_filesize = 2M
16 :
upload_max_filesize = 16M

10

-
6) , , :
extension=php_bz2.dll
extension=php_curl.dll
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll
7) :
;date.timezone =
(
):
date.timezone = "Europe/Moscow"
8) :
;session.save_path = "/tmp"
:
session.save_path = "C:/php/tmp"
"C:\php\tmp" .
php.ini.
PHP PATH
. "Start" ("") -> "Control Panel" (" ") ->
"System" (""), "Advanced" (""), "Environment
Variables" (" "), "System Variables" (" ")
"Path", "Variable Value" (" "),
, PHP, , "C:\php" ( ).
.
, .
Path:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\php;C:\Program
Files\MySQL\MySQL Server 5.5\bin
PHP .
:
php_bz2.dll PHP
bzip2.
php_curl.dll ,
, -.
php_gd2.dll , .
PHP HTML ? ! PHP ,
.
php_mbstring.dll - ,
(, , ), (UTF-8)
.
php_mysql.dll -
MySQL.
php_mysqli.dll
PHP MySQL 4.1.3 .
PHP. ,
, ,
, ,
PHP.
11

Apache HTTP Server 2.2.22


: http://www.apache.org/
(Apache 2.2 Win32 Binary): http://www.apachelounge.com/download/
: httpd-2.2.22-win32.zip
. -,
. :)
, - , .


C:\Apache2.

Apache.

"C:\Apache2\conf\httpd.conf",

. , .
, . :)
"httpd.conf"
1) mod_rewrite (
"#") :
LoadModule rewrite_module modules/mod_rewrite.so
2) PHP , :
LoadModule php5_module "C:/php/php5apache2_2.dll"
3) PHP, :
PHPIniDir "C:/php"
4) :
ServerName www.example.com:80
:
ServerName localhost:80
5) :
DocumentRoot "c:/Apache2/htdocs"
( ):
DocumentRoot "C:/apache"

12

-
6) :
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
:
<Directory />
Options Includes Indexes FollowSymLinks
AllowOverride All
Allow from all
</Directory>
7) (
), :
<Directory "c:/Apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
8) :
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
:
<IfModule dir_module>
DirectoryIndex index.html index.htm index.shtml index.php
</IfModule>
9) :
ErrorLog "logs/error.log"
(
):
ErrorLog "C:/apache/error.log"
10) :
CustomLog "logs/access.log" common
:
CustomLog "C:/apache/access.log" common
11) SSI ( ) ,
<IfModule mime_module>, :
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
12) , <IfModule mime_module>, :
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
13) , , :
Include conf/extra/httpd-mpm.conf
Include conf/extra/httpd-autoindex.conf
Include conf/extra/httpd-vhosts.conf
Include conf/extra/httpd-manual.conf
Include conf/extra/httpd-default.conf

13

-
"httpd.conf"
"C:\Apache2\conf\extra\httpd-vhosts.conf"
:
,
:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/apache/localhost/www"
ServerName localhost
ErrorLog "C:/apache/localhost/error.log"
CustomLog "C:/apache/localhost/access.log" common
</VirtualHost>
"httpd-vhosts.conf"
, Apache2.2.

Apache2.2

"C:\Apache2\bin\httpd.exe -k install"

14

Apache2.2.
, - Apache2.2
: "Start" ("") "Control Panel" (" ") "Administrative Tools"
("") "Services" (""),
"Apache2.2" , "General" ("")
- "Startup type: Manual" (" : ").
, . ,
-, , ,
, .

"apache" -
(), "error.log" ( ,
), "access.log" ( ).
"apache" - "localhost", , ,
"www", . ,
,
Unix, .

:
"httpd-vhosts.conf", , , :
<VirtualHost *:80>
# , .
DocumentRoot "C:/apache/test.ru/www"
# .
ServerName test.ru
# ( ) .
ServerAlias www.test.ru
# , .
ErrorLog "C:/apache/test.ru/error.log"
# .
CustomLog "C:/apache/test.ru/access.log" common
</VirtualHost>

15

-
"apache", "test.ru" ( , ), , ,
"www".

C:\WINDOWS\system32\drivers\etc\hosts .
:
127.0.0.1 test.ru
127.0.0.1 www.test.ru
Apache "C:\Apache2\bin\httpd.exe -k start",
, "test.ru" "www.test.ru"
. ,
("www.test.ru", ),
: "127.0.0.1 www.test.ru", "hosts".
Apache, , "http://localhost/manual/".
Apache "C:\Apache2\bin\httpd.exe -k stop".
Apache, "C:\Apache2\bin\httpd.exe -k
restart".
- Apache .

, "hosts" ,
, Apache, MySQL,
"hosts" : ,
.
"C:\apache" :
"vhosts-off.txt" "hosts" "vhosts-on.txt"
. ,
"vhosts-on.txt", C:\WINDOWS\system32\drivers\etc\hosts.
.
"vhosts-off.txt" ( ):
127.0.0.1

localhost

"vhosts-on.txt" "www.test.ru" "test.ru":


127.0.0.1
127.0.0.1
127.0.0.1

localhost
www.test.ru
test.ru

"C:\apache", : "start-webserver.bat"
"hosts", "stop-webserver.bat"
"hosts".

16

, "start-webserver.bat":
@echo off
echo.
if not exist C:\apache\vhosts-on.txt goto no_vhosts
echo Create virtual hosts:
copy /v /y C:\apache\vhosts-on.txt C:\WINDOWS\system32\drivers\etc\hosts
echo.
:no_vhosts
NET start Apache2.2
NET start MySQL
, "stop-webserver.bat":
@echo off
echo.
if not exist C:\apache\vhosts-off.txt goto no_vhosts
echo Restore hosts file:
copy /v /y C:\apache\vhosts-off.txt C:\WINDOWS\system32\drivers\etc\hosts
echo.
:no_vhosts
NET stop Apache2.2
NET stop MySQL
,
"C:\apache" "vhosts-on.txt" "vhosts-off.txt".
Apache Monitor,
Apache, "start-webservermonitor.bat", "start-webserver.bat"
:
start "" "C:\Apache2\bin\ApacheMonitor.exe"
"start-webservermonitor.bat", "start-webserver.bat", "stop-webserver.bat".
, "C:\apache",
, , .

17

phpMyAdmin 3.5.0
: http://phpmyadmin.net/
( all-languages.zip ): http://phpmyadmin.net/home_page/downloads.php
: http://php-myadmin.ru/
, phpMyAdmin
MySQL. ,
. ,
, . :)
Apache "C:\Apache2\bin\httpd.exe -k stop",

"stop-webserver.bat".

"C:\apache\localhost\www\". , ,
"phpmyadmin". , "C:\apache\localhost\www\phpmyadmin" "config.inc.php"
( "root",
MySQL):
<?php
$i = 0;
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = ''; // root
?>
, phpMyAdmin,
"mysqli", MySQL 5, PHP 5,
.
, "httpd.conf" :
<IfModule alias_module>
:
Alias /pma "C:/apache/localhost/www/phpmyadmin"
"start-webserver.bat"
"localhost/phpmyadmin". phpMyAdmin
MySQL.
Apache ( ), phpMyAdmin ,
:
" /pma". : "http://www.test.ru/pma".
phpMyAdmin,
, ,
.

18

-
"phpmyadmin"
, "Import"
(""), , "File to import" (" ")
"Browse..." ("..."), "create_tables.sql", "examples",
"Go" ("OK").
"pma"
, "Privileges" (""),
"Add a new User" (" "), "Login Information"
(" ") :
User name ( ): pma
Host (): localhost
Password ():
"Go" ("OK").
, "Database-specific privileges" (" ")
"Add privileges on the following database:" ("
") "phpmyadmin". , "Databasespecific privileges" (" "), "Data" (""),
: SELECT, INSERT, UPDATE, DELETE "Go" ("OK").
phpMyAdmin
"config.inc.php" .
:
<?php
$i = 0;
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = ''; /* root. */
$cfg['Servers'][$i]['controlhost'] = 'localhost';
$cfg['Servers'][$i]['controluser'] = 'pma'; /*
. */
$cfg['Servers'][$i]['controlpass'] = ''; /* . */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['tracking'] = 'pma_tracking';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
$cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
$cfg['Servers'][$i]['recent'] = 'pma_recent';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs';
?>

phpMyAdmin.
. phpMyAdmin ,
- . . - . :)

19

, ,
. - .
, .
- . !


htmlbook.ru - http://htmlbook.ru/
HTML CSS, .
Notepad++ - http://notepad-plus.sourceforge.net/ru/site.htm
: HTML, PHP, JavaScript, SQL.

,
http://php-myadmin.ru - .
.

20