PHP+APACHE開發環境搭建

1.環境

        入門級安裝教程,環境搭建php

        window32位+httpd-2.4.10-win32-VC11+php-5.6.31-Win32-VC11-x86html

2.操做:

        下載對應的安裝包,可自行百度。解壓到非中文目錄,最好不要帶符號mysql

php安裝

        解壓壓縮文件後複製php.ini-production,更名爲php.ini,用記事本打開(notepad++),sql

搜索extension_dir = "ext",去掉前面的;改成安裝目錄的路徑,以下所示apache

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
 extension_dir = "D:/php/ext"

; Directory where the temporary files should be placed.
; Defaults to the system default (see sys_get_temp_dir)
; sys_temp_dir = "/tmp"

接下路搜索以下去前面沒有引號的地方,找到後,去掉引號windows

;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_exif.dll      ; Must be after mbstring as it depends on it
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client

搜索找到data.timezone,改成date.timezone =PRCapp

這裏主要是修改時間。不然php默認的時間與中國時間有時間差ide

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone =PRC

 

apache安裝

直接解壓後,進入Apache24\conf\httpd.conf,找到ServerRoot,這裏爲apache的默認目錄,以下spa

#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used.  If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "c:/Apache24"

找到後替換,將路徑替換爲本地apache目錄。c:/Apache24所有替換爲D:/Apache24.net

 

在httpd.conf中添加以下內容支持php

LoadModule php5_module "D:/php/php5apache2_4.dll"
PHPIniDir "D:/php"
AddType application/x-httpd-php .php .html .htm

 

而後在Apache24\htdocs目錄下新建index.php文件,內容以下

<?php
phpinfo();
?>

保存後,退出。

注意:

運行Apache24\bin\httpd.exe,這裏我電腦提示msvcp100.dll缺失,須要下載window插件,網址https://www.microsoft.com/en-us/download/details.aspx?id=30679

進行下載

3.啓動Apache

 上述完成後打開Apache24\bin\httpd.exe文件,會停留在一個窗口下,別關。訪問http://localhost/index.php

訪問到php版本信息,配置成功

相關文章
相關標籤/搜索