Apache2.2.17+PHP5.2.5+MySQL5安装说明配置遇到问题解决笔记

Apache2.2.17+PHP5.2.5+MySQL5安装说明


C:\Program Files\Apache Software Foundation\Apache2.2\conf


httpd.conf


修改端口号:
#Listen 12.34.56.78:8080
Listen 8080


修改网站根目录:
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
DocumentRoot "E:/php"
目录末尾不用加/。


更改根目录之后如果提示:
Forbidden
You don't have permission to access / on this server.
那么则要修改:
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    allow from all
</Directory>




修改主页显示.php页面
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>


【每次修改完 httpd.conf 之后都要重启 apache 服务器!】


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


PHP5


For Windows的四个版本,VC9 x86 Non Thread Safe、VC9 x86 Thread Safe、VC6 x86 Non Thread Safe、VC6 x86 Thread Safe,
一、如何选择PHP5.3的VC9版本和VC6版本
VC6就是legacy Visual Studio 6 compiler,就是使用这个编译器编译的。
VC9就是the Visual Studio 2008 compiler,就是用微软的VS编辑器编译的。
【如果你是在windows下使用Apache+PHP的,请选择VC6版本;】
如果你是在windows下使用IIS+PHP的,请选择VC9版本。
二、如何选择PHP5.3的Thread Safe和Non Thread Safe版本
    先从字面意思上理解,Thread Safe是线程安全,执行时会进行线程(Thread)安全检查,以防止有新要求就启动新线程的CGI执行方式而耗尽系统资源。Non Thread Safe是非线程安全,在执行时不进行线程(Thread)安全检查。
    再来看PHP的两种执行方式:ISAPI和FastCGI。
    ISAPI执行方式是以DLL动态库的形式使用,可以在被用户请求后执行,在处理完一个用户请求后不会马上消失,所以需要进行线程安全检查,这样来提高程序的执行效率,所以如果是以ISAPI来执行PHP,建议选择Thread Safe版本;
    而FastCGI执行方式是以单一线程来执行操作,所以不需要进行线程的安全检查,除去线程安全检查的防护反而可以提高执行效率,所以,如果是以FastCGI来执行PHP,建议选择Non Thread Safe版本。
    官方并不建议你将Non Thread Safe 应用于生产环境,所以我们【选择Thread Safe 版本的PHP来使用。】


选择.zip格式下载 .msi格式部分功能受限


将压缩包解压到 C:\Program Files\php


把php.ini-development(php.ini-dist在PHP5.1.2之前用的是这个名字)重命名为PHP.INI
php.ini-production对应于php.ini-recommended
php.ini-development对应于php.ini-dist


extension_dir=XXXX改成你自己PHP的安装目录放置"php_*.dll"文件的路径。
; Directory in which the loadable extensions (modules) reside.
extension_dir = "./"
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
extension_dir = "C:\Program Files\php\ext"




修改doc_root=XXXX改成你自己APACHE的根目录
doc_root =
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
doc_root ="E:\php"


修改默认字符集GB2312 去掉前面分号;
default_mimetype = "text/html"
;default_charset = "iso-8859-1"
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
default_charset = "gb2312"




修改register_globals
register_globals = Off
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
register_globals =On


去掉前面的分号 激活
extension=php_dba.dll
extension=php_dbase.dll
extension=php_gd2.dll
extension=php_mssql.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


修改几个地方 然后把修改好的php.ini文件复制到C:\WINDOWS\目录里
将phpts.dll复制到c:\winnt\system32 目录下


整合apache到php5
回到apache之中
C:\Program Files\Apache Software Foundation\Apache2.2\conf
httpd.conf


在文件最末尾添加两行代码:

LoadModule php5 _module


LoadModule php5_module "C:\Program Files\php\php5apache2_2.dll"
AddType application/x-httpd-php .php


mysql 的环境变量
我的电脑—》属性—》高级—》环境变量—》系统变量 选中 Path 项—》点编辑在行尾加上你的 MYSQL 的bin文件夹的路径。项与项之间用;号隔开。例如 ;D:\MySQL\bin 你可以先进入 bin 文件夹,然后把地址栏里的路径复制到 Path 值后面。


D:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Program Files\php;C:\Program Files\php\ext;



$cfg['blowfish_secret'] = 'http://localhost:8080/dbm/'; 


"无法加载 mysql (外链,英语) 扩展,请检查您的 PHP 配置" 
cannot load MySQL extension, please check PHP Configuration".
如果是windows安装,你看下dll扩展是否放好了:
c盘 
windows下(xp系统)放入php_msql.dll,php_mysqli.dll增加msql mysqli的扩展
system32下放入libmysql.dll,php5ts.dll
还有你的ini里边
;extension=mysql.so改为:extension=mysql.so


PhpMyAdmin 错误 "Cannot load mysql extension. Please check your PHP configuration"
Cannot load mysql extension. Please check your PHP configuration.


;extension=php_mysql.dll   ==>> extension=php_mysql.dll
;extension=php_mysqli.dll  ==>> extension=php_mysqli.dll
extension_dir  “”               ==>> extension_dir = “C:\Program Files\PHP”


Content of config.inc.php is:


<?
$cfg['Servers'][1]['host'] = ‘localhost’;
$cfg['Servers'][1]['extension'] = ‘mysql’;
$cfg['Servers'][1]['connect_type'] = ‘tcp’;
$cfg['Servers'][1]['compress'] = false;
$cfg['Servers'][1]['auth_type'] = ‘config’;
$cfg['Servers'][1]['user'] = ‘root’;
$cfg['Servers'][1]['password'] = ‘aaaa’;


?>




无法加载 mcrypt
在系统的system32(一般为C:\WINDOWS\system32)目录下缺少libmcrypt.dll文件。解决方法是找到php目录下的libmcrypt.dll,将其复制到C:\WINDOWS\system32目录中,然后重新启动Web服务。 
3、在C:\WINDOWS目录下的php.ini文件中,没有将“;extension=php_mcrypt.dll”中的前面一个“;”去掉,所以不能使用相应功能,解决方法是打开php.ini文件,找到 ;extension=php_mcrypt.dll 改成
extension=php_mcrypt.dll    去掉前面的;使之生效 






phpmyadmin 配置
phpMyAdmin
默认用户名:root 
密码是最初安装时候设置的密码:123;


 


一、连接MYSQL。
格式: mysql -h主机地址 -u用户名 -p用户密码
1、连接到本机上的MYSQL。
首先打开DOS窗口,然后进入目录mysql\bin,再键入命令mysql -u root -p,回车后提示你输密码.注意用户名前可以有空格也可以没有空格,但是密码前必须没有空格,否则让你重新输入密码.
如果刚安装好MYSQL,超级用户root是没有密码的,故直接回车即可进入到MYSQL中了,MYSQL的提示符是: mysql>
2、连接到远程主机上的MYSQL。假设远程主机的IP为:110.110.110.110,用户名为root,密码为abcd123。则键入以下命令:
mysql -h110.110.110.110 -u root -p 123;(注:u与root之间可以不用加空格,其它也一样)
3、退出MYSQL命令: exit (回车)
二、修改密码。
格式:mysqladmin -u用户名 -p旧密码 password 新密码
1、给root加个密码ab12。首先在DOS下进入目录mysql\bin,然后键入以下命令
mysqladmin -u root -password ab12
注:因为开始时root没有密码,所以-p旧密码一项就可以省略了。
2、再将root的密码改为djg345。
mysqladmin -u root -p ab12 password djg345
三、增加新用户。
(注意:和上面不同,下面的因为是MYSQL环境中的命令,所以后面都带一个分号作为命令结束符)
格式:grant select on 数据库.* to 用户名@登录主机 identified by “密码”
1、增加一个用户test1密码为abc,让他可以在任何主机上登录,并对所有数据库有查询、插入、修改、删除的权限。首先用root用户连入MYSQL,然后键入以下命令:
grant select,insert,update,delete on *.* to [email=test1@”%]test1@”%[/email]” Identified by “abc”;
但增加的用户是十分危险的,你想如某个人知道test1的密码,那么他就可以在internet上的任何一台电脑上登录你的mysql数据库并对你的数据可以为所欲为了,解决办法见2。
2、增加一个用户test2密码为abc,让他只可以在localhost上登录,并可以对数据库mydb进行查询、插入、修改、删除的操作(localhost指本地主机,即MYSQL数据库所在的那台主机),
这样用户即使用知道test2的密码,他也无法从internet上直接访问数据库,只能通过MYSQL主机上的web页来访问了。
grant select,insert,update,delete on mydb.* to [email=test2@localhost]test2@localhost[/email] identified by “abc”;
如果你不想test2有密码,可以再打一个命令将密码消掉。
grant select,insert,update,delete on mydb.* to [email=test2@localhost]test2@localhost[/email] identified by “”;
下篇我是MYSQL中有关数据库方面的操作。注意:你必须首先登录到MYSQL中,以下操作都是在MYSQL的提示符下进行的,而且每个命令以分号结束。
一、操作技巧
1、如果你打命令时,回车后发现忘记加分号,你无须重打一遍命令,只要打个分号回车就可以了。
也就是说你可以把一个完整的命令分成几行来打,完后用分号作结束标志就OK。
2、你可以使用光标上下键调出以前的命令。
二、显示命令
1、显示当前数据库服务器中的数据库列表:
mysql> SHOW DATABASES;
注意:mysql库里面有MYSQL的系统信息,我们改密码和新增用户,实际上就是用这个库进行操作。
2、显示数据库中的数据表:
mysql> USE 库名;
mysql> SHOW TABLES;
3、显示数据表的结构:
mysql> DESCRIBE 表名;
4、建立数据库:
mysql> CREATE DATABASE 库名;
5、建立数据表:
mysql> USE 库名;
mysql> CREATE TABLE 表名 (字段名 VARCHAR(20), 字段名 CHAR(1));
6、删除数据库:
mysql> DROP DATABASE 库名;
7、删除数据表:
mysql> DROP TABLE 表名;
8、将表中记录清空:
mysql> DELETE FROM 表名;
9、显示表中的记录:
mysql> SELECT * FROM 表名;
10、往表中插入记录:
mysql> INSERT INTO 表名 VALUES (”hyq”,”M”);
11、更新表中数据:
mysql-> UPDATE 表名 SET 字段名1=’a',字段名2=’b’ WHERE 字段名3=’c';
12、用文本方式将数据装入数据表中:
mysql> LOAD DATA LOCAL INFILE “D:/mysql.txt” INTO TABLE 表名;
13、导入.sql文件命令:
mysql> USE 数据库名;
mysql> SOURCE d:/mysql.sql;
14、命令行修改root密码:
mysql> UPDATE mysql.user SET password=PASSWORD(’新密码’) WHERE User=’root’;
mysql> FLUSH PRIVILEGES;
15、显示use的数据库名:
mysql> SELECT DATABASE();
16、显示当前的user:
mysql> SELECT USER();
三、一个建库和建表以及插入数据的实例
drop database if exists school; //如果存在SCHOOL则删除
create database school; //建立库SCHOOL
use school; //打开库SCHOOL
create table teacher //建立表TEACHER
(
id int(3) auto_increment not null primary key,
name char(10) not null,
address varchar(50) default ‘深圳’,
year date
); //建表结束
//以下为插入字段
insert into teacher values(”,’allen’,'大连一中’,'1976-10-10′);
insert into teacher values(”,’jack’,'大连二中’,'1975-12-23′);
如果你在mysql提示符键入上面的命令也可以,但不方便调试。
(1)你可以将以上命令原样写入一个文本文件中,假设为school.sql,然后复制到c:\\下,并在DOS状态进入目录[url=file://\\mysql\\bin]\\mysql\\bin[/url],然后键入以下命令:
mysql -uroot -p密码 < c:\\school.sql
如果成功,空出一行无任何显示;如有错误,会有提示。(以上命令已经调试,你只要将//的注释去掉即可使用)。
(2)或者进入命令行后使用 mysql> source c:\\school.sql; 也可以将school.sql文件导入数据库中。
四、将文本数据转到数据库中
1、文本数据应符合的格式:字段数据之间用tab键隔开,null值用[url=file://\\n]\\n[/url]来代替.例:
3 rose 大连二中 1976-10-10
4 mike 大连一中 1975-12-23
假设你把这两组数据存为school.txt文件,放在c盘根目录下。
2、数据传入命令 load data local infile “c:\\school.txt” into table 表名;
注意:你最好将文件复制到[url=file://\\mysql\\bin]\\mysql\\bin[/url]目录下,并且要先用use命令打表所在的库。
五、备份数据库:(命令在DOS的[url=file://\\mysql\\bin]\\mysql\\bin[/url]目录下执行)
1.导出整个数据库
导出文件默认是存在mysql\bin目录下
mysqldump -u 用户名 -p 数据库名 > 导出的文件名
mysqldump -u user_name -p123456 database_name > outfile_name.sql
2.导出一个表
mysqldump -u 用户名 -p 数据库名 表名> 导出的文件名
mysqldump -u user_name -p database_name table_name > outfile_name.sql
3.导出一个数据库结构
mysqldump -u user_name -p -d –add-drop-table database_name > outfile_name.sql
-d 没有数据 –add-drop-table 在每个create语句之前增加一个drop table
4.带语言参数导出
mysqldump -uroot -p –default-character-set=latin1 –set-charset=gbk –skip-opt database_name > outfile_name.sql




没有找到 PHP 扩展 mbstring,而您现在好像在使用多字节字符集。没有 mbstring 扩展的 phpMyAdmin 不能正确分割字符串,可能产生意想不到的结果。
配置文件现在需要一个短语密码。


解决方法:
win系统:
打开c:\windows\php.ini

;extension=php_mbstring.dll
改成
extension=php_mbstring.dll
unix:
打开/etc/php.ini

;extension=php_mbstring.so
改成
extension=php_mbstring.so 
可能通过查看phpinfo();来确认php.ini的位置及PHP当前支持的一些特性。


新版本的PhpMyAdmin 增强了安全性,需要在配置文件设置一个短语密码。否则进入之后会有“配置文件现在需要一个短语密码。”的红色警叹提示。


    解决方法:
    1、将 phpMyAdmin/libraries/config.default.php中的
    $cfg['blowfish_secret'] = ''; 改成 $cfg['blowfish_secret'] = '123456'; (注:其中的’123456′为随意的字符)
    2、在phpMyAdmin目录中,打开config.sample.inc.php,18行
    $cfg['blowfish_secret'] = ''; 改成 $cfg['blowfish_secret'] = '123456'; (注:其中的’123456′为随意的字符)
    这个密码用于Cookies的加密,以免多个PhpMyAdmin或者和其他程序共用Cookies时搞混。
    做好以上两步,刷新网页,OK,“配置文件现在需要一个短语密码。”的提示不存在了!



phpmyadmin链接表的附加功能尚未激活。要查出原因,请点击此处




链接表的附加功能尚未激活。要查出原因,请点击此处。phpmyadmin版本v3以上的好像都会有这个问题
第一步:使用Mysql治理员帐号通过phpmyadmin登陆,然后点击“导进”,然后点击“浏览”按钮,找到phpmyadmin文件夹下的scripts文件夹里的一个名为create_tables.sql的文件。把它导进就OK了。


附网上解决方法补充(把phpmyadmin目录下scripts/create_tables_mysql_4_1_2+.sql(根据版本选择,如果mysql版本小于4.1.2,就使用create_tables.sql)如果提示错误,可以先导入create_tables.sql,然后再导入一次create_tables_mysql_4_1_2+.sql。我用3.38版 没有这一步操作,也能解决问题)


第二步:打开phpmyadmin文件夹下的libraries文件夹,找到名为config.default.php的文件,使用文本编辑工具(不推荐使用记事本,建议使用Dreamweaver之类的工具)打开该文件。对其进行修改。


V3.38版本直接在根目录修改config.inc.php进行修改。


修改的内容并非连续的,请手动进行修改,请勿复制。


修改前的内容:


$cfg['Servers'][$i]['pmadb']=”;


$cfg['Servers'][$i]['bookmarktable']=”;


$cfg['Servers'][$i]['relation']=”;


$cfg['Servers'][$i]['table_info']=”;


$cfg['Servers'][$i]['table_coords']=”;


$cfg['Servers'][$i]['pdf_pages']=”;


$cfg['Servers'][$i]['column_info']=”;


$cfg['Servers'][$i]['history']=”;


$cfg['Servers'][$i]['designer_coords']=”;


$cfg['Servers'][$i]['tracking']=”;


修改后的内容:


$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]['designer_coords']=‘pma_designer_coords’;


$cfg['Servers'][$i]['tracking']=‘pma_tracking’;






将libraries/config.default.php中的$cfg['PmaAbsoluteUri']改为






$cfg['PmaAbsoluteUri'] = ‘http://127.0.0.1/phpMyAdmin/‘; 
$cfg['PmaAbsoluteUri'] = 'http://localhost:8080/phpMyAdmin/';
第三步:注销phpmyadmin之后并重新登录。大功告成!
 




/* User for advanced features */
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Advanced phpMyAdmin features */
// $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';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';




config.default.php




$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';


/**
 * Bookmark table
 *   - leave blank for no bookmark support
 *     SUGGESTED: 'pma_bookmark'
 *
 * @global string $cfg['Servers'][$i]['bookmarktable']
 */
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';


/**
 * table to describe the relation between links (see doc)
 *   - leave blank for no relation-links support
 *     SUGGESTED: 'pma_relation'
 *
 * @global string $cfg['Servers'][$i]['relation']
 */
$cfg['Servers'][$i]['relation'] = 'pma_relation';


/**
 * table to describe the display fields
 *   - leave blank for no display fields support
 *     SUGGESTED: 'pma_table_info'
 *
 * @global string $cfg['Servers'][$i]['table_info']
 */
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';


/**
 * table to describe the tables position for the PDF schema
 *   - leave blank for no PDF schema support
 *     SUGGESTED: 'pma_table_coords'
 *
 * @global string $cfg['Servers'][$i]['table_coords']
 */
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';


/**
 * table to describe pages of relationpdf
 *   - leave blank if you don't want to use this
 *     SUGGESTED: 'pma_pdf_pages'
 *
 * @global string $cfg['Servers'][$i]['pdf_pages']
 */
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';


/**
 * table to store column information
 *   - leave blank for no column comments/mime types
 *     SUGGESTED: 'pma_column_info'
 *
 * @global string $cfg['Servers'][$i]['column_info']
 */
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';


/**
 * table to store SQL history
 *   - leave blank for no SQL query history
 *     SUGGESTED: 'pma_history'
 *
 * @global string $cfg['Servers'][$i]['history']
 */
$cfg['Servers'][$i]['history'] = 'pma_history';


/**
 * table to store the coordinates for Designer
 *   - leave blank for no Designer feature
 *     SUGGESTED: 'pma_designer_coords'
 *
 * @global string $cfg['Servers'][$i]['designer_coords']
 */
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';


/**
 * table to store SQL tracking
 *   - leave blank for no SQL tracking
 *     SUGGESTED: 'pma_tracking'
 *
 * @global string $cfg['Servers'][$i]['tracking']
 */
$cfg['Servers'][$i]['tracking'] = 'pma_tracking';


修改这个!
/**
 * Disable the default warning that is displayed on the DB Details Structure page if
 * any of the required Tables for the relation features could not be found
 *
 * @global boolean $cfg['PmaNoRelation_DisableWarning']
 */
$cfg['PmaNoRelation_DisableWarning'] = true;



http://wenku.baidu.com/view/1008890dba1aa8114431d9da.html
http://wenku.baidu.com/view/51ec1cf7ba0d4a7302763a06.html
http://hi.baidu.com/eteek/blog/item/5f5d32ada4eece0a4b36d6ca.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值