PHP网站搭建的注意事项,PHP+Apache开发环境搭建注意事项

又是因为重装系统的原因,不得不重新走一遍PHP+Apache+MySQL的路,发现每一次搭建都会遇到不一样的坑,这次依然是不是很顺利,一大堆问题,慢慢叙来。

安装PHP

安装版本: php-5.6.25-Win32-VC11-x64

首先要注意的是,PHP和Apache的版本一定要对应,否则装了之后你会发现Apache一直启动不了,我就是在这个问题上困惑了很久…

其实php官方网站是有提到这一点的,只是当时不太注意,所以说还是要仔细看官网的东西。

php有VC9,VC11和VC14三种版本,分别对应的前置条件是你系统中必须先安装有VS2008 SP1、VS2012和VS2015

所以你系统中如果已经装了以上某个VS,就直接装上对应版本的PHP就好了。

另外每个版本的PHP有对应有TS和NTS版本,分别是线程安全和非线程安全版本,直接安装安全版本就好了。

安装ApacheThe requiest operation has failed

我PHP安装的是php-5.6.25-Win32-VC11-x64,所以Apache也要安装对应的64位VC11版本。

安装完之后,将bin目录下的ApacheMonitor.exe添加到环境变量中,同时记复制php目录下的php.ini-development为php.ini,修改配置开启需要的extension,然后复制一份到C盘windows目录下。双击ApacheMonitor看是否能启动成功。

安装MySQL

以前安装MySQL基本没什么问题,这一次出现了这么一个错误提示:TIMESTAMP with implicit DEFAULT value is deprecated.

解决方法: 找到安装目录的my-default.ini,复制一份为my.ini,内容如下# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

# DO NOT EDIT THIS FILE. It’s a template which will be copied to the

# default location during install, and will be replaced if you

# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data

# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.

innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging

# changes to the binary log between backups.

# log_bin

# These are commonly set, remove the # and set as required.

basedir = C:/Program Files/MySQL/MySQL Server 5.6

datadir = C:/Program Files/MySQL/MySQL Server 5.6/data

port = 3306

server_id = 1

default-character-set=utf8

# Remove leading # to set options mainly useful for reporting servers.

# The server defaults are faster for transactions and fast SELECTs.

# Adjust sizes as needed, experiment to find the optimal values.

join_buffer_size = 128M

sort_buffer_size = 2M

read_rnd_buffer_size = 2M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

explicit_defaults_for_timestamp=true #重点是这一句

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值