Table of Contents
浅谈本地WAMP环境的搭建
Home php教程 php手册 浅谈本地WAMP环境的搭建

浅谈本地WAMP环境的搭建

Jun 13, 2016 am 09:04 AM
wamp environment

浅谈本地WAMP环境的搭建

   所谓的WAMP环境就是Windows+Apache+Mysql+PHP开发运行环境啦,这对于我们学习php开发来说是最基础的一步了,虽然说现在集成开发环境一抓一大把,但是作为基本功还是必须要学到手的。

  在php本地搭建过程中,php环境配置是至关重要的一部分,本文就php在本地的环境配置中作简要说明。以供大家学习!

  配置Windows+Apache+Mysql+PHP开发运行环境

  安装Apache

  获取 Apache Server 下载

  这个是包括了open ssl 模块的window可执行程序,直接运行安装到我们需要放置的目录下面。注意使用80端口,这样不必额外制定端口号就可以访问本地Http Server了

  一切安装好后,打开浏览器,输入http://localhost进行测试,出现“It Works”那么安装就成功

  安装Mysql

  获取 Mysql 下载

  安装 Mysql,这个是打包好了的安装包,一路根据提示安装上即可

  另外还有一个Mysql Workbench,这个是一个可视化的Mysql管理软件,可以一同下下来或者选用别的顺手的管理客户端均可。

  用管理客户端链接本地的Mysql,能连接上说明安装成功

  安装PHP

  获取 PHP 下载。可以看到多个版本提供我们呢选择:

  如果Apache的版本是1或2,那么下载VC6编译的版本

  如果选用IIS作为Server,那么使用VC9编译的版本

  X86代表32位的操作系统,X64则代表64位操作系统

  Thread Safe和Non Thread Safe,取决于Web Server对PHP的执行方式。如果是ISAPI,需要调用dll来处理用户请求,由于处理完后相关dll不会马上消失,所以需要进行线程安全检查以使用多线程,从而提高效率,使用Thread Safe较好。如果是Fast CGI,由于只进行单线程的运行,因此没必要进行线程并发下的安全性检查,去掉线程安全检查等于取消不必要的系统耗费从而提高运行速度,使用 Non Thread Safe的较好。

  这里也有直接的安装包,直接安装即可,但我们选择ZIP包进行手工安装,一来手工安装更灵活,二来可以了解PHP的内部结构,这个对于以后进一步使用PHP来说比较重要哦。

  将压缩包解压到你的目标磁盘目录,如解压后的目录类似C:\php,注意目录间最好不用空格,由于有的Web Server可能不支持带空格的路径。

  配置php5ts.dll路劲的环境变量。在根目录下面有些dll含有Web Server的名字,这些相关的Server模块可以让Web Server运行PHP时更加高效。所有的模块都需要用到php5ts.dll,因此需要让系统知道他的位置,查找顺序一般为:

  php.exe的执行位置,或者Web Server的执行目录(一般为bin)如果Web Server使用了server模块

  环境变量PATH下包含的路径

  把当前的根目录加到PATH下,这样无论Web Server如何配置,系统都可以寻找到php5ts.dll

  配置PHP初始化信息,直接把php.ini-production复制后改名为php.ini即可,PHP运行时会自动查找并读取php.ini文件。另外如果使用Windows NT, 2000, XP 或 2003上的NTFS格式,确保运行Web Server的用户对php.ini有读取的权限。

  关联PHP和Apache,此配置后Apache便具有PHP的解析能力。这里有两种方式去设置PHP与Apache的协同工作。一种是作为CGI,另一种是作为Apache的模块来安装,上面提到Server模块更好,因此我采用这种方式安装,将以下三行加入Apache的httpd.conf中即可。

   代码如下:

  LoadModule php5_module "c:/php/php5apache2_2.dll"

  AddType application/x-httpd-php .php

  PHPIniDir "C:/php"

  集成检测

  最后来检查下我们的环境是否正常工作。

  新建一个文本名称加扩展名为test.ini

  在文件中添加如下代码:

   代码如下:

  

  phpinfo();

  ?>

  将其放到Apache Server的htdocs目录下

  接着在浏览器中输入http://localhost/test.php,如果出现了PHP的版本及组件相关统计信息,说明正常工作了。其中mysqlnd为enable说明Mysql的驱动也正常启用了。

  这样一个WAMP环境就搭建起来了,这个环境是进行开发与学习的基础,就先介绍到这里了。最后祝大家学习愉快,早日屌丝逆袭哇。。。

  以上就是本文的全部内容了,希望大家能够喜欢。

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 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)

Unable to boot into Windows recovery environment Unable to boot into Windows recovery environment Feb 19, 2024 pm 11:12 PM

Windows Recovery Environment (WinRE) is an environment used to repair Windows operating system errors. After entering WinRE, you can perform system restore, factory reset, uninstall updates, etc. If you are unable to boot into WinRE, this article will guide you through fixes to resolve the issue. Unable to boot into the Windows Recovery Environment If you cannot boot into the Windows Recovery Environment, use the fixes provided below: Check the status of the Windows Recovery Environment Use other methods to enter the Windows Recovery Environment Did you accidentally delete the Windows Recovery Partition? Perform an in-place upgrade or clean installation of Windows below, we have explained all these fixes in detail. 1] Check Wi

What are the differences between Python and Anaconda? What are the differences between Python and Anaconda? Sep 06, 2023 pm 08:37 PM

In this article, we will learn about the differences between Python and Anaconda. What is Python? Python is an open source language that places great emphasis on making the code easy to read and understand by indenting lines and providing whitespace. Python's flexibility and ease of use make it ideal for a variety of applications, including but not limited to scientific computing, artificial intelligence, and data science, as well as creating and developing online applications. When Python is tested, it is immediately translated into machine language because it is an interpreted language. Some languages, such as C++, require compilation to be understood. Proficiency in Python is an important advantage because it is very easy to understand, develop, execute and read. This makes Python

Teach you to create a virtual host and run php projects (phpstudy + wamp) Teach you to create a virtual host and run php projects (phpstudy + wamp) Aug 07, 2022 pm 03:17 PM

This article involves two PHP integrated environments, both of which contain mysql + apache + php. The function of phpstudy is more powerful than wamp, and it is very simple and easy to use.

How to modify the php.ini file in wamp How to modify the php.ini file in wamp Mar 20, 2023 pm 03:33 PM

Wampserver is a software package that can install Apache, PHP and MySQL on Windows computers. Develop and test PHP websites on your local computer easily with Wampserver. During the development process, we may need to modify the PHP configuration file php.ini. This article will introduce how to modify the php.ini file in Wampserver.

11 Ways to Set Environment Variables on Windows 3 11 Ways to Set Environment Variables on Windows 3 Sep 15, 2023 pm 12:21 PM

Setting environment variables on Windows 11 can help you customize your system, run scripts, and configure applications. In this guide, we'll discuss three methods along with step-by-step instructions so you can configure your system to your liking. There are three types of environment variables System environment variables – Global variables are the lowest priority and are accessible to all users and applications on Windows and are typically used to define system-wide settings. User Environment Variables – Higher priority, these variables only apply to the current user and process running under that account, and are set by the user or application running under that account. Process environment variables – have the highest priority, they are temporary and apply to the current process and its sub-processes, providing the program

What are the PHP integrated environment packages? What are the PHP integrated environment packages? Jul 24, 2023 am 09:36 AM

PHP integrated environment packages include: 1. PhpStorm, a powerful PHP integrated environment; 2. Eclipse, an open source integrated development environment; 3. Visual Studio Code, a lightweight open source code editor; 4. Sublime Text, a A popular text editor, widely used in various programming languages; 5. NetBeans, an integrated development environment developed by the Apache Software Foundation; 6. Zend Studio, an integrated development environment designed for PHP developers.

Common problems and solutions for Laravel environment configuration file .env Common problems and solutions for Laravel environment configuration file .env Mar 10, 2024 pm 12:51 PM

Common problems and solutions for Laravel environment configuration file .env When using the Laravel framework to develop projects, the environment configuration file .env is very important. It contains key configuration information of the project, such as database connection information, application keys, etc. However, sometimes there are some common problems when configuring the .env file. This article will introduce these problems and provide solutions, and attach specific code examples for reference. Problem 1: Unable to read the .env file when we have configured the .env file

[Summary] Reasons and solutions why WAMP cannot parse PHP files [Summary] Reasons and solutions why WAMP cannot parse PHP files Mar 22, 2023 am 10:38 AM

​WAMP is a free and open source web server software package that allows users to build a web server environment on Windows operating systems. However, when users try to run PHP files in WAMP, they may encounter unresolved errors. In this article, we will explore the reasons and solutions for why WAMP cannot parse PHP files.

See all articles