Apache+php+MySql手动配置

备忘一下


备忘一下:



一. Apacha2.2 修改 httpd.conf, 添加以下配置:

	#PHP配置
	LoadModule php5_module "D:/PHP5.4/php5apache2_2.dll"
	AddHandler application/x-httpd-php .php

	# 配置 php.ini 的路径
	PHPIniDir "D:/PHP5.4"

        #修改一下配置,让apache优先转发php请求
        <IfModule dir_module>
            DirectoryIndex index.php index.html
        </IfModule>
ps:把httpd.exe 加入系统服务:
httpd.exe -k install -n apache2.2
删除:sc delete apache2.2
二。php的配置

//关于php 的版本选择:--------------------
Please use the Apache builds provided by Apache Lounge. They also provide VC11 builds of Apache for x86 and x64. We use their binaries to build the Apache SAPIs.

If you are using PHP with Apache 1 or Apache2 from apache.org (not recommended) you need to use the older VC6 versions of PHP compiled with the legacy Visual Studio 6 compiler. Do NOT use VC9+ versions of PHP with the apache.org binaries.

With Apache you have to use the Thread Safe (TS) versions of PHP.
//-----------------------------------

	复制 php.ini-production,并重命名为 php.ini
	添加D:/PHP5.4 到环境变量的path中。
	
	去掉以下dll的注释:
	extension=php_gd2.dll
	extension=php_mbstring.dll
	extension=php_mysql.dll
        extension=php_pdo_mysql.dll //drupal需要这个
        
        其它配置:时区:
        [Date]
          date.timezone = Asia/Shanghai
        会话:
        [Session]
          session.save_path = "D:/PHP5.4/tmp"
        动态链接库目录:
          extension_dir = "ext"
三.解压zip文件,安装最简单的来。
	复制my-small.ini,重命名为 my.ini
	添加D:/MySQL/bin的位置到环境变量的path中。
	在[mysqld]里面,添加以下几行配置:

	basedir="D:/MySQL"
	datadir="D:/MySQL/data" 
	character-set-server=utf8


	//安装MySQL为服务(要求cmd以管理员身份运行)
	c:\>mysqld --install MySQL --defaults-file="D:/MySQL/my.ini" 

	//启动服务
	c:\> net start MySQL

	//更改mysql的用户密码
	//  root 初始密码为空
	c:\> mysql -u root -p

	#登录mysql
	>use mysql
	>update user set password=password("new_pass") where user="userName";  #userName换成你要修改的用户名的密码,比如root
	>flush privileges;
	>exit;
四、关于链接的静态化:
	1)开启apache 的mod_rewrite模块,去掉注释:
		LoadModule rewrite_module modules/mod_rewrite.so
		
	2)修改 AllowOverride选项
		<Directory "E:/workspace_shawn/CMS">
		   
		    #
		    # AllowOverride controls what directives may be placed in .htaccess files.
		    # It can be "All", "None", or any combination of the keywords:
		    #   Options FileInfo AuthConfig Limit
		    #
		    AllowOverride All


		</Directory>
	3)在wordpress里面,选一个静态链接的选项,系统会在wordpress的根目录生成一个.htaccess文件。搞定!

	4)因为我本机的目录CMS,并不是wordpress的更目录,所以.htaccess其实访问不到。
		只有手动copy内容到 httpd.conf里面啦。呵呵。
		<VirtualHost shawn.tianya.cn:1234>
		    DocumentRoot "E:\workspace_shawn\CMS"
		    ServerName shawn1234
		    <IfModule rewrite_module.c>
		        RewriteEngine On
		        RewriteBase /wordpress/
		        RewriteRule ^index\.php$ - [L]
		        RewriteCond %{REQUEST_FILENAME} !-f
		        RewriteCond %{REQUEST_FILENAME} !-d
		        RewriteRule . /wordpress/index.php [L]
		    </IfModule>

		</VirtualHost>

你可能感兴趣的:(apache)