爱技术 & 爱分享
爱蛋蛋 & 爱生活

PHP安装

PHP

PHP吧,首先,我们得知道官网是什么对吧,这里 php.net

然后我们得下载PHP,地址 http://php.net/downloads.php

如果你在近期看到本文章的话,点击下载地址你会看到下面的这幅图。

DownLoad

现在最新的 Releases 是7.1.11

然后呢我选择的是 Windows downloads(别问我为什么不用Linux ,因为我自己有几个服务都快把我Linux的云服务器跑炸了,所以还是在Windows 上来玩这个吧)

现在应该是可以看到下面的图了:
Windows DownLoad

现在有一个比较重要的选择来了,TS(Thread Safe,线程安全)与NTS(Not Thread Safe,非线程安全)。不过官方还是很nice的,这些都考虑到了的

仔细看一下左边的侧边栏都说了些什么你就知道该怎么选了。

IIS

If you are using PHP as FastCGI with IIS you should use the Non-Thread Safe (NTS) versions of PHP.

Apache

Please use the Apache builds provided by Apache Lounge. They provide VC11, VC14 and VC15 builds of Apache for x86 and x64. We use their binaries to build the Apache SAPIs.

If you are using PHP as module with Apache builds from apache.org (not recommended) you need to use the older VC6 versions of PHP compiled with the legacy Visual Studio 6 compiler. Do NOT use VC11+ versions of PHP with the apache.org binaries.

With Apache you have to use the Thread Safe (TS) versions of PHP.

大意呢就是如果你用的是IIS服务器,并且使用的是FastCGI的方式,那么你就选择NTS吧。Apache的话,就选择TS

更加详细的解释就是:TS,使用的是多线程构建,NTS使用的是单进程,在FastCGI模式时,便尽量选择NTS以提升性能。

关于CGI与FastCGI是什么,并且有什么区别的话,看看我博客中的相关文章吧。

接下来就是 选择 SourceCode,ZIP,DebugPack 了,如果我们不是专门做PHP相关开发的话,选择ZIP就好了,所以我这里选择的是 VC14 X64的Thread Safe ZIP。

下载下来就是个压缩文件,然后你找个你自己喜欢的地方解压开就好了,Windows下面的话,可以配置一下环境变量,但是不配置也没啥问题,只不过需要在用的时候多加一下路径就好了。

如果要配置环境变量的话:解压开之后将其本身路径及其ext文件夹路径加入到path环境变量

将 php.ini-production 或者php.ini-development 复制一份,并重命名为php.ini;

用记事本打开php.ini
; extension_dir = "ext"修改为 extension_dir = "ext"(去掉extension前面的分号)
;extension=php_mbstring.dll修改为 extension=php_mbstring.dll(去掉extension前面的分号,这是php多字节字符串扩展)
;extension=php_mysql.dll修改为 extension=php_mysql.dll(去掉extension前面的分号)
;extension=php_mysqli.dll 修改为 extension=php_mysqli.dll(去掉extension前面的分号)

然后如果是配合Apache的话
893行 ;extension=php_curl.dll 去掉前面的分号
896行 ;extension=php_gd2.dll 去掉前面的分号
903行 ;extension=php_mbstring.dll 去掉前面的分号
905行 ;extension=php_mysqli.dll 去掉前面的分号
909行 ; extension=php_pdo_mysql.dll 去掉前面的分号

然后新建test.php 文件 内容如下

然后在dos下执行 php test.php命令(注意目录)

正确输出PHP信息即为成功。

赞(1) 传送门
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。编程日志 » PHP安装
分享到: 更多 (0)

游戏 && 后端

传送门传送门