Apache+PHP+MySQL环境搭建

时间:2022-09-14 15:38:57

准备安装包:
Apache: apache_2.2.11-win32.msi (http://pan.baidu.com/s/1nvdiNcH)
PHP: php-5.2.5-Win32.zip (http://pan.baidu.com/s/1gePhS5t)
MySQL: https://dev.mysql.com/downloads/mysql/

安装:

1.默认安装Apache,打开网页输入:127.0.0.1 回车,如果现实: It works 说明安排成功
2.安装PHP:解压PHP压缩包(解压到D:/php)
3.按照 MYSQL

整合Apache+PHP+MySQL

1.配置 Apache:
1.1 打开httpd.conf文本文件,找到“#LoadModule vhost_alias_module modules/mod_vhost_alias.so" 添加:
LoadModule php5_module "D:/php/php5apache2_2.dll"
PHPIniDir "D:/php"
AddType application/x-httpd-php .php .html .htm

1.2 修改 DirectoryIndex index.html为:DirectoryIndex index.php index.html


2.配置 PHP

2.1 进入php文件夹,重命名php.ini-recommended 为php.ini
2.2 修改php.ini内容:
2.2.1 修改 extension_dir = "./" 为 extension_dir = "D:/php/ext"
2.2.2 将如下dll文件注释取消
      extension=php_curl.dll
  extension=php_gd2.dll
  extension=php_mbstring.dll
  extension=php_mysql.dll
  extension=php_xmlrpc.dll
2.3. 设置时区,找到
  ;date.timezone =
  改为
  date.timezone = Asia/Shanghai


3.配置完成,检测一下配置是否成功。重启Apache,在Apache的htdoc目录下新建文件test.php,输入内容:
<?php
phpinfo();
?>

4、打开网页http://127.0.0.1/test.php