首頁 >php教程 >php手册 >php环境搭建,php搭建

php环境搭建,php搭建

WBOY
WBOY原創
2016-06-13 09:06:41947瀏覽

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文件

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

修改 </span><span>;</span><span>extension=php_mbstring.dll</span>
extension=<span>php_mbstring.dll (php多字节字符串扩展)

修改 </span><span>;</span><span>extension=php_mysql.dll</span>
extension=<span>php_mysql.dll

修改 </span><span>;</span><span>extension=php_mysqli.dll</span>
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"<br />ServerRoot "D:/program_files/Apache24"<br /><br /><span>修改 #ServerName www.example.com:80
ServerName www.example.com:</span>80<span>

修改 DocumentRoot </span>"c:/Apache24/htdocs"<span>
DocumentRoot </span>"D:/program_files/Apache24/htdocs"<span>

修改 <Directory </span>"c:/Apache24/htdocs"<span>>
<Directory </span>"D:/program_files/Apache24/htdocs"<span>>

修改 DirectoryIndex index.html
DirectoryIndex index.html index.php index.htm

修改 ScriptAlias /cgi-bin/ </span>"c:/Apache24/cgi-bin/"<span>
ScriptAlias /cgi-bin/ </span>"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 <span>install<br />net start apache2.4</span>

  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.<span>6</span>/bin/mysqld.exe --console

  4) 登陆MySQL数据库,并创建用户

mysql -u root<br /><br />CREATE USER 'devlop'@'localhost' IDENTIFIED BY '123456';<br />GRANT ALL PRIVILEGES ON *.* TO 'devlop'@'localhost' WITH GRANT OPTION;

  更多MySQL用户管理点击这里

  5) 安装并启动MySQL服务(需要使用管理员权限)

mysqld --<span>install</span> MySQL<br />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

 

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn