Home php教程 php手册 php运行环境搭建!!!

php运行环境搭建!!!

Jun 06, 2016 pm 07:45 PM
php study build newbie environment net run

对于学习php的新手,由于网上的配置方法都是很久之前的,及时性不高, 环境 配置往往令人很头疼,我初学php配置 环境 时配 置了3个晚上,每次总是会出现这样或那样的问题,如今把最新版的PHP5.5.15Apache2.4.10MySQL5.6.20,win7x86的配置方法 分享给大家,64


    对于学习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


php运行环境搭建!!!


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/,此处选择的为免安装版,参看下图


php运行环境搭建!!!


方法/步骤3、配置PHP


将F:\phptools\php5.5\php.ini-production 复制一份,并重命名为php.ini;


将 F:\phptools\php5.5和F:\phptools\php5.5\ext加入环境变量PATH中,选中计算机,右键属性-->高级系 统设置 -->环境变量-->系统变量,找到Path,编辑,在其后加上;F:\phptools\php5.5;F:\phptools \php5.5\ext,如下图,


php运行环境搭建!!!


方法/步骤4、配置Apache


用记事本打开F:\phptools\Apache2.4\Apache24\conf\httpd.conf查找ServerRoot,修改ServerRoot "C:/Apache24" 修改为 ServerRoot "F:/phptools/Apache2.4/Apache24"(这里输入的是你解压apache安装包后放的位置)


查找#ServerName www.example.com:80 ,修改为 ServerName www.example.com:80 (去掉前面的#)


查找DocumentRoot "c:/Apache24/htdocs" , 修改为DocumentRoot "F:/phptools/Apache2.4/Apache24/htdocs" (如果一样,就不用改) 


查找 ,修改为 (如果一样,就不用改) 


查找DirectoryIndex index.html ,修改为 DirectoryIndex index.html index.php index.htm (这里我们添加了index.php index.htm)


查找ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"  ,修改为 ScriptAlias /cgi- bin/ " F:/phptools/Apache2.4/Apache24/cgi-bin" (如果一样,也不用改)


查找 修改为  (如果一样,也不用改)


在 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,如果你下载的是我提供的连接肯定是有的)


添加 AddType application/x-httpd-php .php .html .htm


添加 PHPIniDir "F:/phptools/php5.5" (告诉apache php.ini的位置)至此,httpd.conf 配置完成,保存httpd.conf 。


php运行环境搭建!!!


方法/步骤5、将apache安装到系统服务中


输入F:\phptools\Apache2.4\Apache24\bin\httpd -k install,回车安装过程如下图所示


php运行环境搭建!!!


方法/步骤6、开启几个常用php扩展


用记事本打开F:\phptools\php5.5\php.ini将; extension_dir = "ext"修改为 extension_dir = "ext" (去掉extension前面的分号)


将;extension=php_mbstring.dll 修改为 extension=php_mbstring.dll(去掉extension前面的分号,这是php多字节字符串扩展)


将;extension=php_mysql.dll修改为 extension=php_mysql.dll(去掉extension前面的分号)


将;extension=php_mysqli.dll 修改为 extension=php_mysqli.dll(去掉extension前面的分号)


php运行环境搭建!!!


方法/步骤7、启动Apache


MySQL免安装版环境配置已写过相关经验,我就不赘述了,参考的朋友可以看我另一篇博客《MYSQL解压缩版本配置安装》


启动apache,有两种启动方式:在windows服务中启动;点击开始,找到计算机,右键-->管理-->服务和应用程序-->服务,找到Apache2.4,右键启动即可,如下图


php运行环境搭建!!!


双击F:\phptools\Apache2.4\Apache24\bin\ApacheMonitor.exe启动,如下图


php运行环境搭建!!!


方法/步骤8、启动MySQL


MySQL免安装版配置成功后,也在服务中启动,启动方法与Apache在服务中启动方式类似,所不同的是,你点击右键启动的是MySQL服务

注意事项


配置Apache时,配置的目录要与你解压放置的目录一致,否则会出错


启动Apache前要先在windows里安装成功才能启动


MySQL免安装版必须要先配置成功后才能启动


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

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

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

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

See all articles