Table of Contents
1、客户端(浏览器)
2、服务器
3、使用XAMPP搭建服务器
  1.XAMPP是什么
  2.XAMPP下载地址
  3.安装XAMPP集成包
4.apache无法正常启动的解决方案(非所有问题的解决方案)
5.测试安装的环境
Home Backend Development PHP Tutorial 【个人笔记】003-PHP基础-01-PHP快速入门-03-PHP环境搭建

【个人笔记】003-PHP基础-01-PHP快速入门-03-PHP环境搭建

Jun 23, 2016 pm 01:37 PM

003-PHP基础-01-PHP快速入门 03-PHP环境搭建

1、客户端(浏览器)

  IE FireFox CHROME Opera Safari

2、服务器

  是运行网站的基本

  是放置程序代码的地方

  环境:apache/nginx

  开发环境:XAMP/WAMP

    X:Linux/IOS/Windows

    A:apache

    M:MySQL

    P:PHP

  服务器环境:LAMP

    Linux

    apache

    MySQL

    PHP

  注:以上是主流开发环境与服务器环境,不是绝对是这样的一个组合

 

  搭建服务器的方式

    1.集成安装环境

    2.单独配置(相对新手比较复杂)

3、使用XAMPP搭建服务器

  1.XAMPP是什么

    XAMPP(Apache+MySQL+PHP+PERL)是一个功能强大的建XAMPP软件站集成软件包

    

    图-1

  2.XAMPP下载地址

    https://www.apachefriends.org/zh_cn/index.html

    根据自己的系统下载相应的安装包

    我的操作系统是Windows 10,我就下载最新版本的(XAMPP for Windows  v5.6.3(PHP5.6.3)(此版本可能已经不是最新版的))(如图-2)

    

    图-2

    注:此内容页显示的是最新版本的,最新版本的XAMPP for Windows 不再支持 Windows XP和Windows Server 2003。

    Windows XP和Windows Server 2003 可以点击“下载 点击这里获得其他版本”标签,去下载早期版本。

    然后会跳转到这个页面(如图-3)

    正常情况下会自动呼出下载文件窗(如图-4),如果没有呼出,则点击“点击这里”

    

    图-3

    选择保存位置,点击“下载”(如图-4)

    

    图-4

  3.安装XAMPP集成包

    下载好的文件(如图-5),右键“使用管理员身份运行”(针对Windows 7版本以上 的用户)

    

    图-5

    点击“NEXT”继续(如图-6)

    

    图-6

    默认是安装所有组件(如图-7)

    

    图-7

    我只安装必要组件和我所需要的组件,其他FTP服务器,Mail服务器等我暂时没用到不选择安装,选好了继续点解“Next”下一步(如图-8)

    

    图-8

    选择安装路径

    注:默认是安装在C盘的,不推荐安装在系统盘,我自己选择安装在D盘

    选好安装路径后,点击“Next”继续下一步(如图-9)

    

    图-9

    这里有个复选框说“了解更多关于Bitnami XAMPP”,复选框勾去掉!(如图-10)

    

    图-10

    点击“Next”,下一步(如图-11)

    

    图-11

    点击“Next”下一步,准备安装(如图-12)

    

    图-12

    安装中。。。莫慢待。。。(如图-13)  

    

    图-13

    安装完成

    询问:”Do you want to start the Contrl Panel now”是否马上要打开控制面板,默认选中。点击Finish(完成)。(如图-14)

    

    图-14

=============================华丽的分割线=====================

4.apache无法正常启动的解决方案(非所有问题的解决方案)

  通常情况下到这一步安装已经完成,能够正常启动XAMPP Control Panel,当然也有特殊情况:(如图-15)

  

  图-15

  大概意思是说默认端口80被其他程序给占用了。所有apache无法正常工作。

  由于我在之前已经安装了IIS,默认端口也是80

  在这里有两个选择

    1、干掉占用80端口的程序(比如我电脑里面的IIS,有点残暴。。。)

    2、修改apache默认端口

  由于IIS我还要用来发布ASP.NET程序,这里我选择修改apache默认端口

  如何修改apache默认端口(两种方式)

    1.第一种方式:点击XAMPP Control Panel 中Apache这一行对应的“Config” 按钮展出菜单,  点击Apache(httpd.conf);(如图-16)

    

    图-16

    然后会自动打开httpd.conf文件。(如图-17)

    

    图-17

    第二种方式:找到httpd.conf文件(这个文件在哪)

    httpd.conf的目录:path\xampp\apache\conf

    path是xampp安装的目录,我选择安装在D盘,所以我的httpd.conf的目录是:D:\xampp\apache\conf(如图-18)

    

    图-18

    我喜欢第二种方式,因为通常修改文件前最好做个备份。

    修改哪些地方(需要修改两个地方)

      1.“Listen 80” 改成“Listen 81”(可以不是81,8080也可以,不被其他程序占用的端口都能使用)

        修改前(如图-19)

        

        图-19

        修改后(如图-20)

        

        图-20

      2.“ServerName localhost:80”改成“ServerName localhost:81”

        修改前(如图-21)

        

        图-21

        修改后(如图-22)

        

        图-22

        保存。

      启动apache

        点击Apache行对应的“Start”实际上Apache字样背景色变浅绿色的时候是可以正常使用了的。

        但是为什么还会报红呢,这跟XAMPP里面的设置ini文件 有关,XAMPP默认初始化文件ini里面初始化apache默认端口号依旧是80.

        然后当初始化到具体apache文件的时候,发现端口号已经是修改之后的81.

        所以是正常的。

        但是,保红虽然能运行,但是看得总是让人不自然,总之就是不爽。(如图-23)

        

        图-23

       如何解决

        如果已经启动,先点击Apache行对应的“Stop”,暂时停止运行。

        然后看手顺图(如图-24,如图-25)

        

        图-24

        

        图-25

        把(如图-25)标注“3”的地方改成81,然后点击标注“3”的“Save”保存,点击标注“2”的“Save”保存。

        点击Stop变成Start正常启动。。。(如图-26)

        

        图-26

        Apache已经正常启动(如图-27)

        

        图-27

        最后就可以点击XAMPP Control Panel “Quit”退出按钮关闭XAMPP控制面板。(如 图-28)

        

        图-28

==============================华丽的分割线===========================

5.测试安装的环境

  浏览器:(URL)地址栏键入:localhost:81(如果端口默认是80则键入localhost),回车。出现如下页面这表示XAMMP安装(配置)已经成功啦。(如图-29)

  

  图-29

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

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)

Hot Topics

Java Tutorial
1662
14
PHP Tutorial
1262
29
C# Tutorial
1235
24
Explain different error types in PHP (Notice, Warning, Fatal Error, Parse Error). Explain different error types in PHP (Notice, Warning, Fatal Error, Parse Error). Apr 08, 2025 am 12:03 AM

There are four main error types in PHP: 1.Notice: the slightest, will not interrupt the program, such as accessing undefined variables; 2. Warning: serious than Notice, will not terminate the program, such as containing no files; 3. FatalError: the most serious, will terminate the program, such as calling no function; 4. ParseError: syntax error, will prevent the program from being executed, such as forgetting to add the end tag.

Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Apr 17, 2025 am 12:06 AM

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values ​​to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

What are HTTP request methods (GET, POST, PUT, DELETE, etc.) and when should each be used? What are HTTP request methods (GET, POST, PUT, DELETE, etc.) and when should each be used? Apr 09, 2025 am 12:09 AM

HTTP request methods include GET, POST, PUT and DELETE, which are used to obtain, submit, update and delete resources respectively. 1. The GET method is used to obtain resources and is suitable for read operations. 2. The POST method is used to submit data and is often used to create new resources. 3. The PUT method is used to update resources and is suitable for complete updates. 4. The DELETE method is used to delete resources and is suitable for deletion operations.

PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

How does PHP handle file uploads securely? How does PHP handle file uploads securely? Apr 10, 2025 am 09:37 AM

PHP handles file uploads through the $\_FILES variable. The methods to ensure security include: 1. Check upload errors, 2. Verify file type and size, 3. Prevent file overwriting, 4. Move files to a permanent storage location.

Explain the difference between self::, parent::, and static:: in PHP OOP. Explain the difference between self::, parent::, and static:: in PHP OOP. Apr 09, 2025 am 12:04 AM

In PHPOOP, self:: refers to the current class, parent:: refers to the parent class, static:: is used for late static binding. 1.self:: is used for static method and constant calls, but does not support late static binding. 2.parent:: is used for subclasses to call parent class methods, and private methods cannot be accessed. 3.static:: supports late static binding, suitable for inheritance and polymorphism, but may affect the readability of the code.

See all articles