/ 中存储网

Windows服务器中配置Apache PHP phpMyAdmin环境的方法

2014-12-16 00:37:01 来源:中存储网

Apache PHP phpMyAdmin 基本配置
 
一、软件版本:
a、Apache
1、下载地址:http://httpd.apache.org/download.cgi
2、版本:apache_2.2.8-win32-x86-no_ssl.msi
 
b、php
1、下载地址:http://www.php.net/downloads.php
2、版本:php-5.2.5-Win32.zip
 
c、phpmyadmin
1、下载地址:http://www.phpmyadmin.net/home_page/downloads.php
2、版本:phpMyAdmin-2.11.5.1-all-languages.zip
 
d、mysql
1、下载地址:http://download.mysql.cn/
2、版本:mysql-5.0.22-win32
 
二、目录结构:
D:Inetpub
D:Inetpubapache
D:Inetpubphp
D:Inetpubwebsites
D:Inetpubwebsitesphpmyadmin
D:Inetpubmysql
 
三、安装配置:
a、Apache
配置改D:Inetpubapacheconfhttpd.conf文件;
 
ServerRoot "D:/Inetpub/apache"
Listen 80
 
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
 
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so
 
#自定义
LoadModule php5_module "D:/Inetpub/php/php5apache2_2.dll"
PHPIniDir "D:/Inetpub/php"
 
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
    User daemon
    Group daemon
</IfModule>
</IfModule>
 
 
ServerAdmin xhcat1025@163.com
 
#自定义
DocumentRoot "D:/Inetpub/websites"
 
#自定义
<Directory "D:/Inetpub/websites">
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    #Deny from all
    Allow from all
</Directory>
 
 
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>
 
#自定义
<IfModule mod_php5.c>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .php3
    AddType application/x-httpd-php-source .phps
</IfModule>
 
<FilesMatch "^.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>
 
 
ErrorLog "logs/error.log"
 
LogLevel warn
 
<IfModule log_config_module>
    LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
    LogFormat "%h %l %u %t "%r" %>s %b" common
 
    <IfModule logio_module>
      LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio
    </IfModule>
 
    CustomLog "logs/access.log" common
</IfModule>
 
<IfModule alias_module>
    ScriptAlias /cgi-bin/ "D:/Inetpub/apache/cgi-bin/"
</IfModule>
 
<IfModule cgid_module>
</IfModule>
 
<Directory "D:/Inetpub/apache/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
 
DefaultType text/plain
 
<IfModule mime_module>
    TypesConfig conf/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
   
    #自定义
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .html
</IfModule>
 
 
ErrorDocument 500 "The server made a boo boo."
ErrorDocument 404 /missing.html
ErrorDocument 404 "/cgi-bin/missing_handler.pl"
ErrorDocument 402 http://localhost/subscription_info.html
 
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
 
B、php
 
另存:D:Inetpubphpphp.ini-recommended文件为php.int,修改php.ini文件:
 
(1)、设置扩展路径
;extension_dir = "./" 去掉前面”;”,改为extension_dir = "D:Inetpubphpext"
 
(2)、查找 extension 去掉以下项目前的 “;”号;
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mhash.dll
extension=php_mime_magic.dll
extension=php_ming.dll
extension=php_mysql.dll
extension=php_xmlrpc.dll
增加:extension_dir = "D:Inetpubphpext"
 
C、phpmyadmin
 
1、另存:D:Inetpubwebsitesphpmyadminconfig.sample.inc.php文件为config.int.php,配置该文件
 
<?php
$cfg['blowfish_secret'] = 'alan.xue'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
$i = 0;
$i++;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = '123';
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>
 
2、或者另存:D:Inetpubwebsitesphpmyadminlibraries config.default.php文件到D:Inetpubwebsitesphpmyadmin目录下,改为 config.ini.php 配置该文件相应项
 
四、环境变量
1、编辑系统变量:
变量名:Path
变量值:D:Inetpubphp;D:Inetpubphpext;
 
五、测试
http://localhost/phpmyadmin