官方网站传送门
PHP之道传送门
第一步,先到官网下载到所需的文件或文档资源。
当前我下载的是最新稳定版本Current Stable PHP 7.1.10 (Changelog)
php-7.1.10.tar.gz源码包是linux/unix平台下用的,要使用还需要用gcc将其中的源码编译成二进制文件以及动态库so。
php-7.1.10-Win32-VC14-x64.zip二进制包是windows下用的,是已经使用VC14编译完毕的二进制文件和动态库dll,可以直接使用。
VC运行库各个版本下载地址列表:
Visual C++ 2005 x64(VC8)
Visual C++ 2005 x86(VC8)
Visual C++ 2008 x64(VC9)
Visual C++ 2008 x86(VC9)
Visual C++ 2010 x64(VC10)
Visual C++ 2010 x86(VC10)
Visual C++ 2012 x64(VC11)
Visual C++ 2012 x86(VC11)
Visual C++ 2013 x64(VC12)
Visual C++ 2013 x86(VC12)
Visual C++ 2015 x64(VC14)
Visual C++ 2015 x86(VC14)
C:\Users\aaron>php -help
Usage: php [options] [-f] [--] [args...]
php [options] -r [--] [args...]
php [options] [-B ] -R [-E ] [--] [args...]
php [options] [-B ] -F [-E ] [--] [args...]
php [options] -S : [-t docroot] [router]
php [options] -- [args...]
php [options] -a
-a Run as interactive shell
-c | Look for php.ini file in this directory
-n No configuration (ini) files will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f Parse and execute .
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-r Run PHP without using script tags ..?>
-B Run PHP before processing input lines
-R Run PHP for every input line
-F Parse and execute for every input line
-E Run PHP after processing all input lines
-H Hide any passed arguments from external tools.
-S : Run with built-in web server.
-t Specify document root for built-in web server.
-s Output HTML syntax highlighted source.
-v Version number
-w Output source with stripped comments and whitespace.
-z Load Zend extension .
args... Arguments passed to script. Use -- args when first argument
starts with - or script is read from stdin
--ini Show configuration file names
--rf Show information about function .
--rc Show information about class <name>.
--re Show information about extension .
--rz Show information about Zend extension .
--ri Show configuration for extension .
好了,这就说明我们的环境变量配置成功了,接下来我们启动PHP 5.4+版本自带的内置的 web 服务器,这样你就可以不用安装和配置功能齐全的 Web 服务器,就可以开始学习 PHP,省去配置服务器的麻烦,从-help命令看到启动内置服务器的命令如下:
php [options] -S : [-t docroot] [router]
启动localhost:8080,文件目录为E:\0Develop\php\workspace\myPHP的内置Web服务器:
C:\Users\aaron>php -S localhost:8080 -t E:\0Develop\php\workspace\myPHP
PHP 7.1.10 Development Server started at Thu Oct 12 15:02:19 2017
Listening on http://localhost:8080
Document root is E:\0Develop\php\workspace\myPHP
Press Ctrl-C to quit.
[Thu Oct 12 15:02:22 2017] ::1:58216 [404]: /php - No such file or directory
[Thu Oct 12 15:02:27 2017] ::1:58220 [404]: / - No such file or directory
启动成功,在浏览器地址栏输入http://localhost:8080,即可访问。
如果你需要将生产环境部署在 Windows 上,那 IIS7 将会提供最稳定和最佳的性能。你可以使用 phpmanager(IIS7 的图形化插件) 让你简单的设置并管理 PHP。IIS7 也有内置的 FastCGI ,你只需要将 PHP 配置为它的处理器即可。更多详情请见dedicated area on iis.net。
一般情况下,使用不同环境开发,会导致你在上线代码时出现 Bug。如果你在 Window 下开发将会用于 Linux 下运行的代码,请应该考虑使用虚拟机。
C:\Users\aaron>php -version
PHP 7.1.10 (cli) (built: Sep 26 2017 20:04:32) ( ZTS MSVC14 (Visual C++ 2015) x64 )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
在E:\0Develop\php\workspace\myPHP目录下,创建hello.php文件,内容为下面代码
echo "Hello world!";
?>
然后在浏览器地址栏输入:http://localhost:8080/hello.php
就可以看到打印Hello world!字样了
一个很简单的办法就是phpinfo();
启动PHP内置的Web服务器,执行下述代码:
将上述hello.php调整下
phpinfo();
?>
访问:http://localhost:8080/hello.php
Thread Safety disabled是NTS,enabled是TS,也可以从PHP Extension Build:API20160303,TS,VC14,看得出VC运行库版本是VC14,是TS(Thread Safety)等信息
https://stackoverflow.com/questions/34903896/what-happened-to-php-mysql-dll
https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7
重要的一点,mysql数据库链接弃用
ext / mysql(从PHP 5.5起;使用ext / mysqli或ext / pdo_mysql)
也就是,php_mysql.dll在php根目录/ext/目录从PHP 5.5起已经被删除,已经被php_pdo_mysql.dll和php_mysqli.dll替换
PHP 7不推荐使用以下扩展程序
ext/ereg (since PHP 5.3; use ext/pcre instead) REMOVED (PECL extension)
ext/mysql (since PHP 5.5; use ext/mysqli or ext/pdo_mysql instead) REMOVED (PECL extension)
参考http://blog.csdn.net/u013474104/article/details/78336084
备注:在PHP5.3以后,PHP不再有ISAPI模式
CGI是个协议,跟进程什么的没关系。那fastcgi又是什么呢?Fastcgi是用来提高CGI程序性能的。
转载了一些好文章,有空再自己分析总结了
待续…
等用到再写了-_-“`