修改1:Define SRVROOT “D:\WorkSoft\Apache\Apache24\conf”
ServerRoot “${SRVROOT}”
修改2:
修改3:
ServerName localhost:8081
D:\WorkSoft\Apache\Apache24\bin
.\httpd.exe -k start
extension_dir = “D:\WorkSoft\PHP\php-8.2.4-Win32-vs16-x64”
; On windows:
;extension_dir = "ext"
extension_dir = "c:/wsr/php/ext"
命令: D:\WorkSoft\PHP\php-8.2.4-Win32-vs16-x64>dir .\ext\
/bphp_bz2.dll
php_com_dotnet.dll
php_curl.dll
php_dba.dll
php_dl_test.dll
php_enchant.dll
php_exif.dll
php_ffi.dll
php_fileinfo.dll
php_ftp.dll
php_gd.dll
php_gettext.dll
php_gmp.dll
php_imap.dll
php_intl.dll
php_ldap.dll
php_mbstring.dll
php_mysqli.dll
php_oci8_19.dll
php_odbc.dll
php_opcache.dll
php_openssl.dll
php_pdo_firebird.dll
php_pdo_mysql.dll
php_pdo_oci.dll
php_pdo_odbc.dll
php_pdo_pgsql.dll
php_pdo_sqlite.dll
php_pgsql.dll
php_shmop.dll
php_snmp.dll
php_soap.dll
php_sockets.dll
php_sodium.dll
php_sqlite3.dll
php_sysvshm.dll
php_tidy.dll
php_xsl.dll
php_zend_test.dll
php_zip.dll
以上文件作为扩展文件加入
;zend_extension=opcache
;扩展文件
extension=php_bz2.dll
extension=php_com_dotnet.dll
extension=php_curl.dll
extension=php_dba.dll
extension=php_dl_test.dll
extension=php_enchant.dll
extension=php_exif.dll
extension=php_ffi.dll
extension=php_fileinfo.dll
extension=php_ftp.dll
extension=php_gd.dll
extension=php_gettext.dll
extension=php_gmp.dll
extension=php_imap.dll
extension=php_intl.dll
extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_mysqli.dll
extension=php_oci8_19.dll
extension=php_odbc.dll
extension=php_opcache.dll
extension=php_openssl.dll
extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
extension=php_pdo_oci.dll
extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
extension=php_shmop.dll
extension=php_snmp.dll
extension=php_soap.dll
extension=php_sockets.dll
extension=php_sodium.dll
extension=php_sqlite3.dll
extension=php_sysvshm.dll
extension=php_tidy.dll
extension=php_xsl.dll
extension=php_zend_test.dll
extension=php_zip.dll
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;
[Date]
; Defines the default timezone used by the date functions
; https://php.net/date.timezone
;date.timezone =
date.timezone = Asia/Shanghai
设置httpd.conf
D:\WorkSoft\Apache\Apache24\conf
#DirectoryIndex: sets the file that Apache will serve if a directory
is requested.
#
# DirectoryIndex index.html
DirectoryIndex index.html index.htm index.php
#LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule sed_module modules/mod_sed.so
#php8
LoadModule php_module "D:/WorkSoft/PHP/php-8.2.4-Win32-vs16-x64/php8apache2_4.dll"
PHPIniDir "D:/WorkSoft/PHP/php-8.2.4-Win32-vs16-x64"
AddType application/x-httpd-php .php .html
.\httpd.exe -k restart
在D:\WorkSoft\Apache\Apache24\htdocs\目录下分别新建index.php、dir1\test.html:
Index.php内容:
";
echo "Hello World!
";
EcHo "Hello World!
";
?>
在浏览器地址栏分别访问http://localhost:8081/index.php、http://localhost:8081/dir1/test.html,可以看到如下的效果:
说明
其中,目录D:\WorkSoft\Apache\Apache24\htdocs为部署项目的目录,如果不想使用默认值,可以修改配置文件D:\WorkSoft\Apache\Apache24\conf\httpd.conf,将DocumnetRoot的值修改为其它的:
#
#DocumentRoot: The directory out of which you will serve your
#documents. By default, all requests are taken from this directory, but
#symbolic links and aliases may be used to point to other locations.
#
#DocumentRoot "${SRVROOT}/htdocs"
DocumentRoot "c:/Users/fy/Desktop/project"
#
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
每次修改配置文件后都需要重启Apache服务,否则修改不生效。至此,所有配置结束。