栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > 服务器

Windows Server 2016 PHP运行环境安装配置

服务器 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力



1、下载PHP

官网地址:

http://php.net/

下载地址:

http://php.net/downloads.php






2、下载Windows Service Wrapper
官网地址:
https://github.com/kohsuke/winsw/
下载地址:
http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/







3、解压PHP压缩包文件到C盘根目录,并且重命名为php



4、将"winsw-1.19-bin.exe"重命名为"php-service.exe",并且复制到PHP根目录



5、在PHP根目录编写php-service.xml文件



php-service.xml文件内容



 PHP
 PHP
 本服务用于加载PHP服务,请确保开机启动。
 C:phplogs
 php-cgi.exe
 -b 127.0.0.1:9000 -c php.ini
 rotate

6、创建服务日志目录

在PHP根目录创建网站目录,命名为"logs"。



7、配置PHP
配置PHP环境变量
按下Win+X+Y键
进入Win系统界面
点击"高级系统设置"—>"高级"—>"环境变量"







在环境变量中,设置三个属性,分别为:

PHP_HOME,Path

(大小写无所谓),若已存在则点击"编辑",不存在则点击"新建"。

a、设置PHP_HOME

变量名:PHP_HOME

变量值:C:php(PHP安装路径)



b、设置Path

变量名:Path

变量值:%PHP_HOME%



环境变量配置完成之后测试是否成功

按下Win+X+C键

打开命令提示符

输入:php -v

看到如下图,说明已经配置成功了。



8、安装PHP系统服务或者卸载PHP系统服务
8.1、安装PHP系统服务
按下Win+X+A键
打开命令提示符(管理员)
输入:
C:phpphp-service.exe install




8.2、卸载PHP系统服务
按下Win+X+A键
打开命令提示符(管理员)
输入:
C:phpphp-service.exe uninstall



9、查看系统服务
9.1、进入服务

运行Win+R输入:

services.msc





9.2、PHP系统服务属性



10、编辑PHP配置文件

PHP配置文件目录:

C:php



10.1、将"php.ini-production"文件重命名为"php.ini"。

10.2、编辑PHP配置文件php.ini

[PHP]
 
;;;;;;;;;;;;;;;;;;;
; about php.ini  ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
 
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
; 1. SAPI module specific location.
; 2. The PHPRC environment variable. (As of PHP 5.2.0)
; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0)
; 4. Current working directory (except CLI)
; 5. The web server's directory (for SAPI modules), or directory of PHP
; (otherwise in Windows)
; 6. The directory from the --with-config-file-path compile time option, or the
; Windows directory (C:windows or C:winnt)
; See the PHP docs for more specific information.
; [url=http://php.net/configuration.file]http://php.net/configuration.file[/url]
 
; The syntax of the file is extremely simple. Whitespace and lines
; beginning with a semicolon are silently ignored (as you probably guessed).
; Section headers (e.g. [Foo]) are also silently ignored, even though
; they might mean something in the future.
 
; Directives following the section heading [PATH=/www/mysite] only
; apply to PHP files in the /www/mysite directory. Directives
; following the section heading [HOST=www.example.com] only apply to
; PHP files served from [url=http://www.example.com.]www.example.com.[/url] Directives set in these
; special sections cannot be overridden by user-defined INI files or
; at runtime. Currently, [PATH=] and [HOST=] sections only work under
; CGI/FastCGI.
; [url=http://php.net/ini.sections]http://php.net/ini.sections[/url]
 
; Directives are specified using the following syntax:
; directive = value
; Directive names are *case sensitive* - foo=bar is different from FOO=bar.
; Directives are variables used to configure PHP or PHP extensions.
; There is no name validation. If PHP can't find an expected
; directive because it is not set or is mistyped, a default value will be used.
 
; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one
; of the INI constants (On, Off, True, False, Yes, No and None) or an expression
; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a
; previously set variable or directive (e.g. ${foo})
 
; expressions in the INI file are limited to bitwise operators and parentheses:
; | bitwise OR
; ^ bitwise XOR
; & bitwise AND
; ~ bitwise NOT
; ! boolean NOT
 
; Boolean flags can be turned on using the values 1, On, True or Yes.
; They can be turned off using the values 0, Off, False or No.
 
; An empty string can be denoted by simply not writing anything after the equal
; sign, or by using the None keyword:
 
; foo =     ; sets foo to an empty string
; foo = None  ; sets foo to an empty string
; foo = "None" ; sets foo to the string 'None'
 
; If you use constants in your value, and these constants belong to a
; dynamically loaded extension (either a PHP extension or a Zend extension),
; you may only use these constants *after* the line that loads the extension.
 
;;;;;;;;;;;;;;;;;;;
; about this file ;
;;;;;;;;;;;;;;;;;;;
; PHP comes packaged with two INI files. One that is recommended to be used
; in production environments and one that is recommended to be used in
; development environments.
 
; php.ini-production contains settings which hold security, performance and
; best practices at its core. But please be aware, these settings may break
; compatibility with older or less security conscience applications. We
; recommending using the production ini in production and testing environments.
 
; php.ini-development is very similar to its production variant, except it is
; much more verbose when it comes to errors. We recommend using the
; development version only in development environments, as errors shown to
; application users can inadvertently leak otherwise secure information.
 
; This is php.ini-production INI file.
 
;;;;;;;;;;;;;;;;;;;
; Quick Reference ;
;;;;;;;;;;;;;;;;;;;
; The following are all the settings which are different in either the production
; or development versions of the INIs with respect to PHP's default behavior.
; Please see the actual settings later in the document for more details as to why
; we recommend these changes in PHP's behavior.
 
; display_errors
;  Default Value: On
;  Development Value: On
;  Production Value: Off
 
; display_startup_errors
;  Default Value: Off
;  Development Value: On
;  Production Value: Off
 
; error_reporting
;  Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
;  Development Value: E_ALL
;  Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
 
; html_errors
;  Default Value: On
;  Development Value: On
;  Production value: On
 
; log_errors
;  Default Value: Off
;  Development Value: On
;  Production Value: On
 
; max_input_time
;  Default Value: -1 (Unlimited)
;  Development Value: 60 (60 seconds)
;  Production Value: 60 (60 seconds)
 
; output_buffering
;  Default Value: Off
;  Development Value: 4096
;  Production Value: 4096
 
; register_argc_argv
;  Default Value: On
;  Development Value: Off
;  Production Value: Off
 
; request_order
;  Default Value: None
;  Development Value: "GP"
;  Production Value: "GP"
 
; session.gc_divisor
;  Default Value: 100
;  Development Value: 1000
;  Production Value: 1000
 
; session.hash_bits_per_character
;  Default Value: 4
;  Development Value: 5
;  Production Value: 5
 
;开启短标签
short_open_tag
Default Value: On
Development Value: Off
Production Value: Off
 
; track_errors
;  Default Value: Off
;  Development Value: On
;  Production Value: Off
 
; url_rewriter.tags
;  Default Value: "a=href,area=href,frame=src,form=,fieldset="
;  Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry"
;  Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry"
 
; variables_order
;  Default Value: "EGPCS"
;  Development Value: "GPCS"
;  Production Value: "GPCS"
 
;;;;;;;;;;;;;;;;;;;;
; php.ini Options ;
;;;;;;;;;;;;;;;;;;;;
; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini"
;user_ini.filename = ".user.ini"
 
; To disable this feature set this option to empty value
;user_ini.filename =
 
; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes)
;user_ini.cache_ttl = 300
 
;;;;;;;;;;;;;;;;;;;;
; Language Options ;
;;;;;;;;;;;;;;;;;;;;
 
; Enable the PHP scripting language engine under Apache.
; [url=http://php.net/engine]http://php.net/engine[/url]
engine = On
 
; This directive determines whether or not PHP will recognize code between
;  tags as PHP source which should be processed as such. It is
; generally recommended that  should be used and that this feature
; should be disabled, as enabling it may result in issues when generating XML
; documents, however this remains supported for backward compatibility reasons.
; Note that this directive does not control the  field with the info which is otherwise appended
; to URLs. If you want XHTML conformity, remove the form entry.
; Note that all valid entries require a "=", even if no value follows.
; Default Value: "a=href,area=href,frame=src,form=,fieldset="
; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry"
; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry"
; [url=http://php.net/url-rewriter.tags]http://php.net/url-rewriter.tags[/url]
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
 
; Enable upload progress tracking in $_SESSION
; Default Value: On
; Development Value: On
; Production Value: On
; [url=http://php.net/session.upload-progress.enabled]http://php.net/session.upload-progress.enabled[/url]
;session.upload_progress.enabled = On
 
; Cleanup the progress information as soon as all POST data has been read
; (i.e. upload completed).
; Default Value: On
; Development Value: On
; Production Value: On
; [url=http://php.net/session.upload-progress.cleanup]http://php.net/session.upload-progress.cleanup[/url]
;session.upload_progress.cleanup = On
 
; A prefix used for the upload progress key in $_SESSION
; Default Value: "upload_progress_"
; Development Value: "upload_progress_"
; Production Value: "upload_progress_"
; [url=http://php.net/session.upload-progress.prefix]http://php.net/session.upload-progress.prefix[/url]
;session.upload_progress.prefix = "upload_progress_"
 
; The index name (concatenated with the prefix) in $_SESSION
; containing the upload progress information
; Default Value: "PHP_SESSION_UPLOAD_PROGRESS"
; Development Value: "PHP_SESSION_UPLOAD_PROGRESS"
; Production Value: "PHP_SESSION_UPLOAD_PROGRESS"
; [url=http://php.net/session.upload-progress.name]http://php.net/session.upload-progress.name[/url]
;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS"
 
; How frequently the upload progress should be updated.
; Given either in percentages (per-file), or in bytes
; Default Value: "1%"
; Development Value: "1%"
; Production Value: "1%"
; [url=http://php.net/session.upload-progress.freq]http://php.net/session.upload-progress.freq[/url]
;session.upload_progress.freq = "1%"
 
; The minimum delay between updates, in seconds
; Default Value: 1
; Development Value: 1
; Production Value: 1
; [url=http://php.net/session.upload-progress.min-freq]http://php.net/session.upload-progress.min-freq[/url]
;session.upload_progress.min_freq = "1"
 
; only write session data when session data is changed. Enabled by default.
; [url=http://php.net/session.lazy-write]http://php.net/session.lazy-write[/url]
;session.lazy_write = On
 
[Assertion]
; Switch whether to compile assertions at all (to have no overhead at run-time)
; -1: Do not compile at all
; 0: Jump over assertion at run-time
; 1: Execute assertions
; Changing from or to a negative value is only possible in php.ini! (For turning assertions on and off at run-time, see assert.active, when zend.assertions = 1)
; Default Value: 1
; Development Value: 1
; Production Value: -1
; [url=http://php.net/zend.assertions]http://php.net/zend.assertions[/url]
zend.assertions = -1
 
; Assert(expr); active by default.
; [url=http://php.net/assert.active]http://php.net/assert.active[/url]
;assert.active = On
 
; Throw an AssertationException on failed assertions
; [url=http://php.net/assert.exception]http://php.net/assert.exception[/url]
;assert.exception = On
 
; Issue a PHP warning for each failed assertion. (Overridden by assert.exception if active)
; [url=http://php.net/assert.warning]http://php.net/assert.warning[/url]
;assert.warning = On
 
; Don't bail out by default.
; [url=http://php.net/assert.bail]http://php.net/assert.bail[/url]
;assert.bail = Off
 
; User-function to be called if an assertion fails.
; [url=http://php.net/assert.callback]http://php.net/assert.callback[/url]
;assert.callback = 0
 
; eval the expression with current error_reporting(). Set to true if you want
; error_reporting(0) around the eval().
; [url=http://php.net/assert.quiet-eval]http://php.net/assert.quiet-eval[/url]
;assert.quiet_eval = 0
 
[COM]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
; [url=http://php.net/com.typelib-file]http://php.net/com.typelib-file[/url]
;com.typelib_file =
 
; allow Distributed-COM calls
; [url=http://php.net/com.allow-dcom]http://php.net/com.allow-dcom[/url]
;com.allow_dcom = true
 
; autoregister constants of a components typlib on com_load()
; [url=http://php.net/com.autoregister-typelib]http://php.net/com.autoregister-typelib[/url]
;com.autoregister_typelib = true
 
; register constants casesensitive
; [url=http://php.net/com.autoregister-casesensitive]http://php.net/com.autoregister-casesensitive[/url]
;com.autoregister_casesensitive = false
 
; show warnings on duplicate constant registrations
; [url=http://php.net/com.autoregister-verbose]http://php.net/com.autoregister-verbose[/url]
;com.autoregister_verbose = true
 
; The default character set code-page to use when passing strings to and from COM objects.
; Default: system ANSI code page
;com.code_page=
 
[mbstring]
; language for internal character representation.
; This affects mb_send_mail() and mbstring.detect_order.
; [url=http://php.net/mbstring.language]http://php.net/mbstring.language[/url]
;mbstring.language = Japanese
 
; Use of this INI entry is deprecated, use global internal_encoding instead.
; internal/script encoding.
; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*)
; If empty, default_charset or internal_encoding or iconv.internal_encoding is used.
; The precedence is: default_charset < internal_encoding < iconv.internal_encoding
;mbstring.internal_encoding =
 
; Use of this INI entry is deprecated, use global input_encoding instead.
; http input encoding.
; mbstring.encoding_traslation = On is needed to use this setting.
; If empty, default_charset or input_encoding or mbstring.input is used.
; The precedence is: default_charset < intput_encoding < mbsting.http_input
; [url=http://php.net/mbstring.http-input]http://php.net/mbstring.http-input[/url]
;mbstring.http_input =
 
; Use of this INI entry is deprecated, use global output_encoding instead.
; http output encoding.
; mb_output_handler must be registered as output buffer to function.
; If empty, default_charset or output_encoding or mbstring.http_output is used.
; The precedence is: default_charset < output_encoding < mbstring.http_output
; To use an output encoding conversion, mbstring's output handler must be set
; otherwise output encoding conversion cannot be performed.
; [url=http://php.net/mbstring.http-output]http://php.net/mbstring.http-output[/url]
;mbstring.http_output =
 
; enable automatic encoding translation according to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
;    portable libs/applications.
; [url=http://php.net/mbstring.encoding-translation]http://php.net/mbstring.encoding-translation[/url]
;mbstring.encoding_translation = Off
 
; automatic encoding detection order.
; "auto" detect order is changed according to mbstring.language
; [url=http://php.net/mbstring.detect-order]http://php.net/mbstring.detect-order[/url]
;mbstring.detect_order = auto
 
; substitute_character used when character cannot be converted
; one from another
; [url=http://php.net/mbstring.substitute-character]http://php.net/mbstring.substitute-character[/url]
;mbstring.substitute_character = none
 
; overload(replace) single byte functions by mbstring functions.
; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
; etc. Possible values are 0,1,2,4 or combination of them.
; For example, 7 for overload everything.
; 0: No overload
; 1: Overload mail() function
; 2: Overload str*() functions
; 4: Overload ereg*() functions
; [url=http://php.net/mbstring.func-overload]http://php.net/mbstring.func-overload[/url]
;mbstring.func_overload = 0
 
; enable strict encoding detection.
; Default: Off
;mbstring.strict_detection = On
 
; This directive specifies the regex pattern of content types for which mb_output_handler()
; is activated.
; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml+xml)
;mbstring.http_output_conv_mimetype=
 
[gd]
; Tell the jpeg decode to ignore warnings and try to create
; a gd image. The warning will then be displayed as notices
; disabled by default
; [url=http://php.net/gd.jpeg-ignore-warning]http://php.net/gd.jpeg-ignore-warning[/url]
;gd.jpeg_ignore_warning = 0
 
[exif]
; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS.
; With mbstring support this will automatically be converted into the encoding
; given by corresponding encode setting. When empty mbstring.internal_encoding
; is used. For the decode settings you can distinguish between motorola and
; intel byte order. A decode setting cannot be empty.
; [url=http://php.net/exif.encode-unicode]http://php.net/exif.encode-unicode[/url]
;exif.encode_unicode = ISO-8859-15
 
; [url=http://php.net/exif.decode-unicode-motorola]http://php.net/exif.decode-unicode-motorola[/url]
;exif.decode_unicode_motorola = UCS-2BE
 
; [url=http://php.net/exif.decode-unicode-intel]http://php.net/exif.decode-unicode-intel[/url]
;exif.decode_unicode_intel  = UCS-2LE
 
; [url=http://php.net/exif.encode-jis]http://php.net/exif.encode-jis[/url]
;exif.encode_jis =
 
; [url=http://php.net/exif.decode-jis-motorola]http://php.net/exif.decode-jis-motorola[/url]
;exif.decode_jis_motorola = JIS
 
; [url=http://php.net/exif.decode-jis-intel]http://php.net/exif.decode-jis-intel[/url]
;exif.decode_jis_intel  = JIS
 
[Tidy]
; The path to a default tidy configuration file to use when using tidy
; [url=http://php.net/tidy.default-config]http://php.net/tidy.default-config[/url]
;tidy.default_config = /usr/local/lib/php/default.tcfg
 
; Should tidy clean and repair output automatically?
; WARNING: Do not use this option if you are generating non-html content
; such as dynamic images
; [url=http://php.net/tidy.clean-output]http://php.net/tidy.clean-output[/url]
tidy.clean_output = Off
 
[soap]
; Enables or disables WSDL caching feature.
; [url=http://php.net/soap.wsdl-cache-enabled]http://php.net/soap.wsdl-cache-enabled[/url]
soap.wsdl_cache_enabled=1
 
; Sets the directory name where SOAP extension will put cache files.
; [url=http://php.net/soap.wsdl-cache-dir]http://php.net/soap.wsdl-cache-dir[/url]
soap.wsdl_cache_dir="/tmp"
 
; (time to live) Sets the number of second while cached file will be used
; instead of original one.
; [url=http://php.net/soap.wsdl-cache-ttl]http://php.net/soap.wsdl-cache-ttl[/url]
soap.wsdl_cache_ttl=86400
 
; Sets the size of the cache limit. (Max. number of WSDL files to cache)
soap.wsdl_cache_limit = 5
 
[sysvshm]
; A default size of the shared memory segment
;sysvshm.init_mem = 10000
 
[ldap]
; Sets the maximum number of open links or -1 for unlimited.
ldap.max_links = -1
 
[mcrypt]
; For more information about mcrypt settings see [url=http://php.net/mcrypt-module-open]http://php.net/mcrypt-module-open[/url]
 
; Directory where to load mcrypt algorithms
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
;mcrypt.algorithms_dir=
 
; Directory where to load mcrypt modes
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
;mcrypt.modes_dir=
 
[dba]
;dba.default_handler=
 
[opcache]
;加载Zend OPCache模块
zend_extension = php_opcache.dll
 
;启用Zend OPCache模块
opcache.enable=1
 
; Determines if Zend OPCache is enabled for the CLI version of PHP
opcache.enable_cli=1
 
;OPcache共享内存存储大小
opcache.memory_consumption=128
 
;在mb内存实际字符串的数量
opcache.interned_strings_buffer=8
 
; 最大数量OPcache哈希表中的键
; only numbers between 200 and 100000 are allowed.
opcache.max_accelerated_files=4096
 
; The maximum percentage of "wasted" memory until a restart is scheduled.
;opcache.max_wasted_percentage=5
 
; When this directive is enabled, the OPcache appends the current working
; directory to the script key, thus eliminating possible collisions between
; files with the same name (basename). Disabling the directive improves
; performance, but may break existing applications.
;opcache.use_cwd=1
 
; When disabled, you must reset the OPcache manually or restart the
; webserver for changes to the filesystem to take effect.
;opcache.validate_timestamps=1
 
; How often (in seconds) to check file timestamps for changes to the shared
; memory storage allocation. ("1" means validate once per second, but only
; once per request. "0" means always validate)
opcache.revalidate_freq=60
 
; Enables or disables file search in include_path optimization
;opcache.revalidate_path=0
 
; If disabled, all PHPDoc comments are dropped from the code to reduce the
; size of the optimized code.
;opcache.save_comments=1
 
; If enabled, a fast shutdown sequence is used for the accelerated code
opcache.fast_shutdown=1
 
; Allow file existence override (file_exists, etc.) performance feature.
;opcache.enable_file_override=0
 
; A bitmask, where each bit enables or disables the appropriate OPcache
; passes
opcache.optimization_level=1
 
;opcache.inherited_hack=1
;opcache.dups_fix=0
 
; The location of the OPcache blacklist file (wildcards allowed).
; Each OPcache blacklist file is a text file that holds the names of files
; that should not be accelerated. The file format is to add each filename
; to a new line. The filename may be a full path or just a file prefix
; (i.e., /var/www/x blacklists all the files and directories in /var/www
; that start with 'x'). Line starting with a ; are ignored (comments).
;opcache.blacklist_filename=
 
; Allows exclusion of large files from being cached. By default all files
; are cached.
;opcache.max_file_size=0
 
; Check the cache checksum each N requests.
; The default value of "0" means that the checks are disabled.
;opcache.consistency_checks=0
 
; How long to wait (in seconds) for a scheduled restart to begin if the cache
; is not being accessed.
;opcache.force_restart_timeout=180
 
; OPcache error_log file name. Empty string assumes "stderr".
;opcache.error_log=
 
; All OPcache errors go to the Web server log.
; By default, only fatal errors (level 0) or errors (level 1) are logged.
; You can also enable warnings (level 2), info messages (level 3) or
; debug messages (level 4).
;opcache.log_verbosity_level=1
 
; Preferred Shared Memory back-end. Leave empty and let the system decide.
;opcache.preferred_memory_model=
 
; Protect the shared memory from unexpected writing during script execution.
; Useful for internal debugging only.
;opcache.protect_memory=0
 
; Allows calling OPcache API functions only from PHP scripts which path is
; started from specified string. The default "" means no restriction
;opcache.restrict_api=
 
; Mapping base of shared memory segments (for Windows only). All the PHP
; processes have to map shared memory into the same address space. This
; directive allows to manually fix the "Unable to reattach to base address"
; errors.
;opcache.mmap_base=
 
; Enables and sets the second level cache directory.
; It should improve performance when SHM memory is full, at server restart or
; SHM reset. The default "" disables file based caching.
;opcache.file_cache=
 
; Enables or disables opcode caching in shared memory.
;opcache.file_cache_only=0
 
; Enables or disables checksum validation when script loaded from file cache.
;opcache.file_cache_consistency_checks=1
 
; Implies opcache.file_cache_only=1 for a certain process that failed to
; reattach to the shared memory (for Windows only). Explicitly enabled file
; cache is required.
;opcache.file_cache_fallback=1
 
; Enables or disables copying of PHP code (text segment) into HUGE PAGES.
; This should improve performance, but requires appropriate OS configuration.
;opcache.huge_code_pages=1
 
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
;curl.cainfo =
 
[openssl]
; The location of a Certificate Authority (CA) file on the local filesystem
; to use when verifying the identity of SSL/TLS peers. Most users should
; not specify a value for this directive as PHP will attempt to use the
; OS-managed cert stores in its absence. If specified, this value may still
; be overridden on a per-stream basis via the "cafile" SSL stream context
; option.
;openssl.cafile=
 
; If openssl.cafile is not specified or if the CA file is not found, the
; directory pointed to by openssl.capath is searched for a suitable
; certificate. This value must be a correctly hashed certificate directory.
; Most users should not specify a value for this directive as PHP will
; attempt to use the OS-managed cert stores in its absence. If specified,
; this value may still be overridden on a per-stream basis via the "capath"
; SSL stream context option.
;openssl.capath=
 
; Local Variables:
; tab-width: 4
; End:

11、创建网站根目录

11.1、在C盘根目录创建网站目录,命名为"wwwroot"。



11.2、在网站根目录创建PHP网站临时目录,命名为"tmp"。



11.3、在网站根目录放入站点目录,命名为"php"。



11.4、在站点目创建一个页面文件,命名为"index.php"。



index.php文件内容

12、编辑Nginx虚拟主机配置文件vhosts.conf

#PHP演示站点
server {
    listen    80;
    server_name 127.0.0.1;
    root  "C:/wwwroot/php";
    location / {
      index index.html index.htm index.php;
      #autoindex on;
    }
    location ~ .php(.*)$ {
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
      fastcgi_param script_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param PATH_INFO $fastcgi_path_info;
      fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
      include    fastcgi_params;
    }
}

13、用命令方式启动、关闭Nginx服务

13.1、启动Nginx服务
按下Win+X+A键
打开命令提示符(管理员)
输入:net start php



13.2、关闭Nginx服务
按下Win+X+A键
打开命令提示符(管理员)
输入:net stop php



14、浏览网页

在IE浏览器中输入:http://127.0.0.1/



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/180842.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号