Maison > développement back-end > tutoriel php > Windows下PHP开发环境配置

Windows下PHP开发环境配置

WBOY
Libérer: 2016-06-23 13:36:10
original
967 Les gens l'ont consulté

准备工作

  • 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
    Copier après la connexion

    创建服务:

    httpd.exe -k install
    Copier après la connexion

    启动服务:运行文件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
    Copier après la connexion

    将php中的php.ini-development改名为php.ini,作为PHP的配置文件。
    修改

    ; extension_dir = "ext"
    Copier après la connexion

    extension_dir = "ext"
    Copier après la connexion

    开启相应的功能库,去掉所在行前面的分号即可

    ;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
    Copier après la connexion

    配置完成,重启Apache,检测一下配置是否成功。在index.html中加入:

    <?php phpinfo(); ?>
    Copier après la connexion

    打开浏览器输入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 
    Copier après la connexion

    创建服务:

    mysqld -install
    Copier après la connexion

    启动服务:

    net  start mysql 
    Copier après la connexion

    删除服务:mysqld -remove,停止服务mysqld stop mysql

    Étiquettes associées:
    source:php.cn
    Déclaration de ce site Web
    Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
    Tutoriels populaires
    Plus>
    Derniers téléchargements
    Plus>
    effets Web
    Code source du site Web
    Matériel du site Web
    Modèle frontal