当前位置:网站首页>A tutorial on how to build a php environment under win
A tutorial on how to build a php environment under win
2022-07-30 12:02:00 【51CTO】
win下搭建php环境的方法
- 下载apache并配置;
- 2、下载PHP并将其解压到wamp目录下的php文件夹;
- 3、下载安装mysql;
- 4、Just modify the configuration file.
本文操作环境:Windows7系统,PHP5.6版,Dell G3电脑.
window10下搭建php的运行环境
It has been used in development beforephp集成环境(eg:phpstudy,xampp等),Haven't tried to use itphp+mysql+apacheBuild it locallyPHP运行环境,So today I suddenly wanted to try to build it,See what troubles will come along the way.The first thing we need is the build tools:
- windows操作系统(我的电脑是win10)
- apache
- MySQL
- php
首先我安装的是apache,
1.Apache的安装:
apache的下载地址http://www.apachelounge.com/download/,Download according to your computer configuration
Download it according to your computer configuration32位的还是64位的.这里我在D盘创建了一个wamp的文件夹,将下载好的apacheUnzip in this directory.Next run as administratorcmd,Then enter step by stepd:\wamp\Apache\bin目录,在该目录下执行httpd -k install 命令,
I execute it for the first timehttpd -k install The installation command encountered the problem above,that should behttpd.confThe default path in the configuration file is wrong,You can manually rewrite it to your actual path.
I also encountered it in the processapachecannot be installed,I checked later that it was installed beforeapache已经被设置为系统服务,删除即可.
删除操作如下(Note also operate as an administrator):
操作:Type in the start launch barservices.msc,Open the list of system services:如图
Of course, I also encountered other problems during the period:
Right click on the image aboveApache2.4-》属性
The path to the executable was found to be wrong,Or the path of the previous integrated environment(Of course, here is what I have modified).
It is modifiable here,方式如下:
Start typing in the search bar to start"regedit"打开注册表在HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ Find the desired service underApache2.4,将其 "ImagePath"Just change the key value to the actual path.Of course the introduction here is just for youapache启动不了的情况,如果你执行了
这条命令,You don't have to do the above.当你执行完httpd -k install,When the following appears,说明你本地的apache已经安装成功了
Errors in red boxes are, in my judgment, ignorable,
Of course, you can also solve this kind of error:
localhost.localdomain. Set the 'ServerName' directive globally to suppress this message apache Start the workaround for this error: 将 apache 的配置文件httpd.conf中的 ServerName Change it to an available domain name or configure it as follows ServerName localhost:80
你在浏览器中输入 http://localhost,如果出现以下页面,说明你的apache已经安装成功了.
Install reference link reference link
2.php的安装
下载地址:https://windows.php.net/downloads/releases/
Then extract the downloaded file to wamp目录下的php文件夹(Do not download non-thread safe versions,里面没有phpX(5,7)apache2_4.dll的拓展文件),配置apache的时候要用到.
3.下载MySQL
接下来就是下载MySQL链接地址https://dev.mysql.com/downloads/mysql/,
我是下载的MySQL5.7版本的,Download according to your operating system32bit或者64bit
将下载的文件解压到wamp目录下的mysql文件夹.
4.修改配置文件
打开D:/wamp/apache/conf文件夹下的httpd.conf文件
找到#LoadModule xml2enc_module modules/mod_xml2enc.so这一行,Add something below this line
然后再找到AddType application/x-gzip .gz .tg Add this line below
AddType application/x-httpd-php .php
apache的配置算是完成了.
然后再打开D:/wamp/php 文件夹下的php.ini-developement文件的文件名改为php.ini,然后对文件进行编辑,
; extension_dir = "./"
; On windows:
extension_dir = "d:/wamp/php5.6/ext"
date.timezone = Asia/Shanghai
Uncomment this line,并且填写extThe actual path to the folder.
Then just turn it onphp的扩展文件
接下来就是配置MySQL了,Open to enterD:/wamp/mysql目录下新建my.ini配置文件,Paste the content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | [mysql] # 设置mysql客户端默认字符集 default-character-set=utf8 [mysqld] #设置3306端口 port = 3306 # 设置mysql的安装目录 basedir=D:\wamp\mysql # 设置mysql数据库的数据的存放目录 datadir=D:\wamp\mysql\data # 允许最大连接数 max_cnotallow=200 # 服务端使用的字符集默认为8比特编码的latin1字符集 character-set-server=utf8 # 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB |
以管理员的身份运行cmd,进入到D:/wamp/mysql/bin目录下安装MySQL服务,输入mysqld install(注意是mysqld不是mysqlBe sure not to dazzle)
The command line shows the line,表示安装成功
Service successfully installed
接下来输入mysqld --initialize创建data文件夹,否则后面无法启动MySQL服务;
然后输入net start mysql就可以启动MySQL服务了
输入mysql -u root -p,Then enter the password to connectMySQL服务
可能会出现以下错误
Download here nowMySQLNeither version supports passwordless authentication by default,We need to manually set the modification,打开my.ini文件,在文件末尾加上一句:
1 | skip-grant-tables |
然后重启MySQL(net stop mysql/net start mysql),You can now connect without a password,But many functions are limited.先连接MySQL,然后选择user数据库修改root用户的密码.
断开MySQL连接,file will be set upmy.inijust added to the fileskip-grant-tables删除,重启MySQL服务,Log in with the password you set.
边栏推荐
- 反转链表-递归反转法
- 历时两月,终拿字节跳动offer,算法面试题分享「带答案」
- Farmers on the assembly line: I grow vegetables in a factory
- Differences between lock spin and mutex usage scenarios
- 如何用Golang来手撸一个Blog - Milu.blog 开发总结
- C# 时间戳与时间的互相转换
- TensorFlow自定义训练函数
- Testability of Fuzzy Discrete Event Systems
- 24. 两两交换链表中的节点
- Performance testing of API Gateway APISIX on Google Cloud T2A and T2D
猜你喜欢
概率论的学习整理4:全概率公式
Horizontal comparison of 5 commonly used registration centers, whether it is used for interviews or technical selection, is very helpful
Program environment and preprocessing (detailed)
contentDocument contentWindow, canvas, svg, iframe
嵌入式环境下并发控制与线程安全
VSCode更改插件的安装位置
概率论的学习整理--番外2:和二项式,组合相关的杨辉三角
MySQL——数据库基础
LeetCode_235_Last Common Ancestor of Binary Search Tree
【ASP.NET Core】选项类的依赖注入
随机推荐
牛客-TOP101-BM42
数字量输入输出模块DAM-5088
GBJ2510-ASEMI电机专用25A整流桥GBJ2510
备战金九银十!2022面试必刷大厂架构面试真题汇总+阿里七面面经+架构师简历模板分享
External Force Estimation Based on Time Delay Estimation with Perturbed Kalman Filter
contentDocument contentWindow, canvas, svg, iframe
概率论的学习整理3: 概率的相关概念
C#调用explorer.exe打开指定目录
Differences between lock spin and mutex usage scenarios
2022-07-29 顾宇佳 学习笔记 异常处理
[Cloud-Building Co-creation] Huawei Cloud and Hongmeng collaborate to cultivate innovative developers
Microsoft SQL服务器被黑客入侵 带宽被窃取
The battle-hardened programmer was also deceived by a fake programmer from a certain fish. The trust between programmers should be the highest, and he alone destroyed this sense of trust
LeetCode_236_Last Common Ancestor of a Binary Tree
11 年膨胀 575 倍,微信为何从“小而美”变成了“大而肥”?
英 文 换 行
decodeURIComponent(), eval(), encodeURIComponent()
Matlab绘图(1)——二维绘图
不用if分支对同一个变量做判断的方法
【ASP.NET Core】选项类的依赖注入