PHP5.5.15+Apache2.4.10+MySQL5.6.20配置方法分享_PHP
对于学习php的新手,由于网上的配置方法都是很久之前的,及时性不高,环境配置往往令人很头疼,我初学php配置环境时配置了3个晚上,每次总是会出现这样或那样的问题,如今把最新版的PHP5.5.15+Apache2.4.10+MySQL5.6.20,win7x86的配置方法分享给大家,64位的同理,不过下载的软件需要也是64位的。
环境:win7 32.(64位的同理,下载相关软件必须是对应的64位版本)
PHP5.5.15(php-5.5.15-Win32-VC11-x86.zip)
Apache2.4.10(httpd-2.4.10-win32-VC11.zip)
MySQL5.6.20(mysql-5.6.20-win32.zip)
方法/步骤1:准备(下载所需软件)
安装apache前必须先安装VC11(VSU_4\vcredist_x86.exe),网址为http://www.microsoft.com/en-us/download/details.aspx?id=30679,选择时选择英文版的,如果win7系统是64位的请下载VSU_4\vcredist_x64.exe,下载页面参看下图
Apache2.4.10(httpd-2.4.10-win32-VC11.zip)网址:http://www.apachelounge.com/download/
PHP5.5.15(php-5.5.15-Win32-VC11-x86.zip)这里我们选择的是线程安全版,关于线程安全版与非线程安全版的区别可自行上网查阅相关资料,下载网址:http://windows.php.net/download/,VC11 x86 Thread Safe为32位的线程安全版
MySQL5.6.20(mysql-5.6.20-win32.zip),网址:http://dev.mysql.com/downloads/mysql/,此处选择的为免安装版,参看下图
方法/步骤2:安装
安装VC11,双击打开,点击若干个下一步直至安装成功就OK了
Apache下载后是zip包,解压到后放在合适的位置就可以了,不建议放在C盘里,因为重装系统C盘的数据会全部丢失,这里我们将它放在F盘的phptools文件夹下的apache2.4目录下
php下载后也是zip包,同样解压到合适位置,我们这里也将其放在F盘的phptools文件夹下的php5.5目录下
MySQL选择的是免安装版的,就更简单了,同样是解压到合适的位置,这里我们也将其放在F盘的phptools文件夹下的MySQL目录下,解压安装后如下图
方法/步骤3:配置PHP
1、将F:\phptools\php5.5\php.ini-production 复制一份,并重命名为php.ini;
2、将 F:\phptools\php5.5和F:\phptools\php5.5\ext加入环境变量PATH中,选中计算机,右键属性-->高级系 统设置 -->环境变量-->系统变量,找到Path,编辑,在其后加上;F:\phptools\php5.5;F:\phptools \php5.5\ext,如下图,
方法/步骤4:配置Apache
1、用记事本打开F:\phptools\Apache2.4\Apache24\conf
查找ServerRoot,修改ServerRoot "C:/Apache24" => ServerRoot "F:/phptools/Apache2.4/Apache24"(这里输入的是你解压apache安装包后放的位置)
2、查找#ServerName www.example.com:80 ,修改为 ServerName www.example.com:80 (去掉前面的#)
3、查找DocumentRoot "c:/Apache24/htdocs" , 修改为DocumentRoot "F:/phptools/Apache2.4/Apache24/htdocs" (如果一样,就不用改)
4、查找
5、查找DirectoryIndex index.html ,修改为 DirectoryIndex index.html index.php index.htm (这里我们添加了index.php index.htm)
6、查找ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/" ,修改为 ScriptAlias /cgi- bin/ " F:/phptools/Apache2.4/Apache24/cgi-bin" (如果一样,也不用改)
7、查找
8、在 F:\phptools\apache2.4.10\conf\httpd.conf最后一行添加添 加 LoadModule php5_module "F:/phptools/php5.5/php5apache2_4.dll" 让 apache 支持php (请确认F:/phptools/ php5.5/有php5apache2_4.dll,如果你下载的是我提供的连接肯定是有的)
9、添加 AddType application/x-httpd-php .php .html .htm
10、添加 PHPIniDir "F:/phptools/php5.5" (告诉apache php.ini的位置)
至此,httpd.conf 配置完成,保存httpd.conf 。
方法/步骤5:将apache安装到系统服务中
输入F:\phptools\Apache2.4\Apache24\bin\httpd -k install,回车
安装过程如下图所示
方法/步骤6:开启几个常用php扩展
1、用记事本打开F:\phptools\php5.5\php.ini
将; extension_dir = "ext"修改为 extension_dir = "ext" (去掉extension前面的分号)
2、将;extension=php_mbstring.dll 修改为 extension=php_mbstring.dll(去掉extension前面的分号,这是php多字节字符串扩展)
3、将;extension=php_mysql.dll修改为 extension=php_mysql.dll(去掉extension前面的分号)
4、将;extension=php_mysqli.dll 修改为 extension=php_mysqli.dll(去掉extension前面的分号)
方法/步骤7:启动Apache
1、MySQL免安装版环境配置,具体请参考:MySQL5.6免安装版环境配置图文教程
2、启动apache,有两种启动方式:
在windows服务中启动;点击开始,找到计算机,右键-->管理-->服务和应用程序-->服务,找到Apache2.4,右键启动即可,如下图
3、双击F:\phptools\Apache2.4\Apache24\bin\ApacheMonitor.exe启动,如下图
方法/步骤8:启动MySQL
MySQL免安装版配置成功后,也在服务中启动,启动方法与Apache在服务中启动方式类似,所不同的是,你点击右键启动的是MySQL服务
注意事项
1)、配置Apache时,配置的目录要与你解压放置的目录一致,否则会出错
2)、启动Apache前要先在windows里安装成功才能启动
3)、MySQL免安装版必须要先配置成功后才能启动
最新php环境搭建成功,谢谢大家的阅读。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

CMS stands for Content Management System. It is a software application or platform that enables users to create, manage, and modify digital content without requiring advanced technical knowledge. CMS allows users to easily create and organize content

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Arrays are linear data structures used to process data in programming. Sometimes when we are processing arrays we need to add new elements to the existing array. In this article, we will discuss several ways to add elements to the end of an array in PHP, with code examples, output, and time and space complexity analysis for each method. Here are the different ways to add elements to an array: Use square brackets [] In PHP, the way to add elements to the end of an array is to use square brackets []. This syntax only works in cases where we want to add only a single element. The following is the syntax: $array[] = value; Example
