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

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


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

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

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver Mac version
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

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

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment