程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> php環境搭建,php搭建

php環境搭建,php搭建

編輯:關於PHP編程

php環境搭建,php搭建


1. 准備所需工具:

1) Windows7 x64

2) php5.5 VC11 x64 Thread Safe 浏覽

3) apache httpd2.4 浏覽

4) MySQL5.6 浏覽

5) phpMyAdmin4.4.1 浏覽

2. 安裝

2.1 安裝PHP

  1) 將php-5.5.23-Win32-VC11-x64.zip解壓到D:\program_files\php5.5

  2) 將D:\program_files\php5.5和D:\program_files\php5.5\ext加入環境變量

  3) 拷貝php.ini-production至php.ini

  4) 修改D:\program_files\php5.5\php.ini文件

修改 ; extension_dir = "ext"
extension_dir = "D:/program_files/php5.5/ext"

修改 ;extension=php_mbstring.dll
extension=php_mbstring.dll (php多字節字符串擴展)

修改 ;extension=php_mysql.dll
extension=php_mysql.dll

修改 ;extension=php_mysqli.dll
extension=php_mysqli.dll  

 

2.2 安裝Apache

  1) 將httpd-2.4.12-win64-VC11.zip解壓到D:\program_files\Apache24

  2) 用記事本打開D:\program_files\Apache24\conf並修改

  

修改 ServerRoot "C:/Apache24"
ServerRoot "D:/program_files/Apache24"

修改 #ServerName www.example.com:80 ServerName www.example.com:80 修改 DocumentRoot "c:/Apache24/htdocs" DocumentRoot "D:/program_files/Apache24/htdocs" 修改 <Directory "c:/Apache24/htdocs"> <Directory "D:/program_files/Apache24/htdocs"> 修改 DirectoryIndex index.html DirectoryIndex index.html index.php index.htm 修改 ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/" ScriptAlias /cgi-bin/ "D:/program_files/Apache24/cgi-bin/"

 行末添加

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

  PHPIniDir "D:/program_files/php5.5"

  3) 安裝並啟動apache服務(需要使用管理員權限)

D:\program_files\Apache24\bin\httpd -k install
net start apache2.4

  4) 在浏覽器中輸入 http://localhost:80

It works!
2.3 安裝MySQL

  1) 將mysql-5.6.24-winx64.zip解壓到D:\program_files\MySQL5.6

  2) 拷貝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.


[mysqld]


# 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 = D:/program_files/MySQL5.6
datadir = D:/program_files/MySQL5.6/data
port = 3306
server_id = 1



# 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

  3) 啟動MySQL

D:/program_files/MySQL5.6/bin/mysqld.exe --console

  4) 登陸MySQL數據庫,並創建用戶

mysql -u root

CREATE USER 'devlop'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'devlop'@'localhost' WITH GRANT OPTION;

  更多MySQL用戶管理點擊這裡

  5) 安裝並啟動MySQL服務(需要使用管理員權限)

mysqld --install MySQL
net start MySQL
2.4 安裝phpMyAdmin

  1) 將phpMyAdmin-4.4.1.1-all-languages.zip解壓到D:\program_files\Apache24\htdocs\phpMyAdmin

  2)  在浏覽器輸入http://localhost:80/phpMyAdmin就可登錄MySQL了。

 

有問題直接聯系QQ:783713515

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved