Windows下PHP開發環境配置

來源:互聯網
上載者:User

標籤:

準備工作
  • Apache:http://www.apachelounge.com/download/
  • PHP:http://windows.php.net/download#php-5.6 (Select the thread safe version)
  • MySQL:http://dev.mysql.com/downloads/windows/installer/
配置步驟

所下載的工具均為免安裝版,解壓至相應目錄即可,筆者將其均放在C盤根目錄下。

Apache配置

開啟Apache24/conf/httpd.conf檔案,修改連接埠(修改連接埠是因為可能存在連接埠衝突)及伺服器名稱

Listen 88ServerName www.example.com:88

建立服務:

httpd.exe -k install

啟動服務:運行檔案Apache24\bin\ApacheMonitor.exe

Apache串連PHP

在Apache24/conf/httpd.conf中添加如下幾行:

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

將php中的php.ini-development改名為php.ini,作為PHP的設定檔。
修改

; extension_dir = "ext"

extension_dir = "ext"

開啟相應的功能庫,去掉所在行前面的分號即可

;extension=php_bz2.dllextension=php_curl.dll;extension=php_fileinfo.dllextension=php_gd2.dll;extension=php_gettext.dll;extension=php_gmp.dll;extension=php_intl.dll;extension=php_imap.dll;extension=php_interbase.dll;extension=php_ldap.dllextension=php_mbstring.dll;extension=php_exif.dll      ; Must be after mbstring as it depends on itextension=php_mysql.dllextension=php_mysqli.dll;extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client;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_pspell.dll;extension=php_shmop.dll

配置完成,重啟Apache,檢測一下配置是否成功。在index.html中加入:

<?php    phpinfo();?>

開啟瀏覽器輸入http://localhost:88,看能否顯示PHP版本資訊。

MySQL配置

將my-default.ini備份,改名為my.ini,更改內容為:

# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html# *** DO NOT EDIT THIS FILE. It‘s a template which will be copied to the# *** default location during install, and will be replaced if you# *** upgrade to a newer version of MySQL.[client] port = 3306 [mysqld] port = 3306 #basedir= "C:/mysql" #datadir= "C:/mysql/data" #default-character-set = gbk #default-storage-engine = INNODB max_connections = 100 max_allowed_packet = 16M# Remove leading # and set to the amount of RAM for the most important data# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.# innodb_buffer_pool_size = 128M# Remove leading # to turn on a very important data integrity option: logging# changes to the binary log between backups.# log_bin# These are commonly set, remove the # and set as required.# basedir = .....# datadir = .....# port = .....# server_id = .....# Remove leading # to set options mainly useful for reporting servers.# The server defaults are faster for transactions and fast SELECTs.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size = 128M# sort_buffer_size = 2M# read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

建立服務:

mysqld -install

啟動服務:

net  start  mysql 

刪除服務:mysqld -remove,停止服務mysqld stop mysql

Windows下PHP開發環境配置

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.