Home Backend Development PHP Tutorial Windows停搭建PHP开发环境

Windows停搭建PHP开发环境

Jun 13, 2016 pm 12:34 PM
apache dll mysql php

Windows下搭建PHP开发环境

Windows下搭建PHP开发环境

PHP集成开发环境有很多,如XAMPP、AppServ......只要一键安装就把PHP环境给搭建好了。但这种安装方式不够灵活,软件的自由组合不方便,同时也不利于学习。所以我还是喜欢手工搭建PHP开发环境,需要哪个模块自己安装就行了,或者那个软件需要升级,直接升级那个软件就行了,并不影响其他软件,非常方便。

?

  一、准备工作-下载所需软件

  • Apache??httpd-2.2.22-win32-x86-openssl-0.9.8t.msi
  • PHP???????php-5.3.10-Win32-VC9-x86.zip
  • MySQL???mysql-5.5.20-win32.msi

?

  二、安装软件

    安装Apache: 双击安装,与安装其他Windows软件没有什么区别,在填Server Infomation时,并没有特殊规定,只要输入的信息符合格式即可。

    安装完成之后,在浏览器输入http://localhost,如果显示It Works!,表示Apache安装成功。

?

    安装PHP:将php-5.3.10-Win32-VC9-x86.zip解压到一个目录即可。

  

    安装MySQL:双击安装,如果需要更改安装目录,则在Choose Setup Type选择Custom

    安装完成后开始配置MySQL,全部保持默认选项即可,但最好把MySQL默认编码改为utf8,在Modify Security Settings选项中设置密码,输入两次密码即可完成,最后点Execute完成配置。

?

  三、整合Apache+PHP+MySQL

    Apache : 首先修改Apache的配置文件,让Apache支持解析PHP文件。Apache配置文件在Apache安装目录的conf目录下的httpd.conf。

?

    1. 让Apache可以解析php文件,在配置文件中找到

        #LoadModule vhost_alias_module modules/mod_vhost_alias.so

      在下一行添加 (绿色的位置是根据PHP的所在目录而定的)

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

?

    2. 在配置文件中找到

        DirectoryIndex index.html

      改为

        DirectoryIndex?index.php?index.html

?

    3. 修改Apache站点目录,在配置文件中找到(Apache安装的目录不同,显示的值不一样)

        DocumentRoot "D:/Develop/Apache2.2/htdocs"

      改为

        DocumentRoot "D:/Workspace/PHP" ? ?(这里是代码php的目录)

      

      再找到

        D:/Develop/Apache2.2/htdocs">

      改为

        D:/Workspace/PHP">   (这里是代码php的目录)

?

?

?

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

?

      1. 设置PHP扩展包的具体目录,找到

        ; On windows:
        ; extension_dir = "ext"

      改为 (值是ext文件夹的目录)

        ; On windows:
        ? extension_dir = "D:/Develop/PHP/ext"

?

      2. 开启相应的库功能,找到需要开启的库的所在行

        ;extension=php_curl.dll

        ;extension=php_gd2.dll

        ;extension=php_mbstring.dll

        ;extension=php_mysql.dll

        ;extension=php_xmlrpc.dll

       ? 去掉前面的分号(注释),即改为

        extension=php_curl.dll

        extension=php_gd2.dll

        extension=php_mbstring.dll

        extension=php_mysql.dll

        extension=php_xmlrpc.dll

      

      3. 设置时区,找到

        ;date.timezone =

        改为

        date.timezone = Asia/Shanghai

       

    配置完成,检测一下配置是否成功。重启Apache,在站点目录下新建文件index.php,输入内容:

?

<?php <span style="color: #008080; line-height: 1.5 !important;">phpinfo();
?>
Copy after login

?

  打开浏览器输入http://localhost,显示如下内容,则安装成功,并且成功关联MySQL。

?

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1665
14
PHP Tutorial
1269
29
C# Tutorial
1249
24
MySQL: The Database, phpMyAdmin: The Management Interface MySQL: The Database, phpMyAdmin: The Management Interface Apr 29, 2025 am 12:44 AM

MySQL and phpMyAdmin can be effectively managed through the following steps: 1. Create and delete database: Just click in phpMyAdmin to complete. 2. Manage tables: You can create tables, modify structures, and add indexes. 3. Data operation: Supports inserting, updating, deleting data and executing SQL queries. 4. Import and export data: Supports SQL, CSV, XML and other formats. 5. Optimization and monitoring: Use the OPTIMIZETABLE command to optimize tables and use query analyzers and monitoring tools to solve performance problems.

Composer: Aiding PHP Development Through AI Composer: Aiding PHP Development Through AI Apr 29, 2025 am 12:27 AM

AI can help optimize the use of Composer. Specific methods include: 1. Dependency management optimization: AI analyzes dependencies, recommends the best version combination, and reduces conflicts. 2. Automated code generation: AI generates composer.json files that conform to best practices. 3. Improve code quality: AI detects potential problems, provides optimization suggestions, and improves code quality. These methods are implemented through machine learning and natural language processing technologies to help developers improve efficiency and code quality.

How to uninstall MySQL and clean residual files How to uninstall MySQL and clean residual files Apr 29, 2025 pm 04:03 PM

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

What is the significance of the session_start() function? What is the significance of the session_start() function? May 03, 2025 am 12:18 AM

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

Steps to add and delete fields to MySQL tables Steps to add and delete fields to MySQL tables Apr 29, 2025 pm 04:15 PM

In MySQL, add fields using ALTERTABLEtable_nameADDCOLUMNnew_columnVARCHAR(255)AFTERexisting_column, delete fields using ALTERTABLEtable_nameDROPCOLUMNcolumn_to_drop. When adding fields, you need to specify a location to optimize query performance and data structure; before deleting fields, you need to confirm that the operation is irreversible; modifying table structure using online DDL, backup data, test environment, and low-load time periods is performance optimization and best practice.

An efficient way to batch insert data in MySQL An efficient way to batch insert data in MySQL Apr 29, 2025 pm 04:18 PM

Efficient methods for batch inserting data in MySQL include: 1. Using INSERTINTO...VALUES syntax, 2. Using LOADDATAINFILE command, 3. Using transaction processing, 4. Adjust batch size, 5. Disable indexing, 6. Using INSERTIGNORE or INSERT...ONDUPLICATEKEYUPDATE, these methods can significantly improve database operation efficiency.

How to use MySQL functions for data processing and calculation How to use MySQL functions for data processing and calculation Apr 29, 2025 pm 04:21 PM

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

How to configure the character set and collation rules of MySQL How to configure the character set and collation rules of MySQL Apr 29, 2025 pm 04:06 PM

Methods for configuring character sets and collations in MySQL include: 1. Setting the character sets and collations at the server level: SETNAMES'utf8'; SETCHARACTERSETutf8; SETCOLLATION_CONNECTION='utf8_general_ci'; 2. Create a database that uses specific character sets and collations: CREATEDATABASEexample_dbCHARACTERSETutf8COLLATEutf8_general_ci; 3. Specify character sets and collations when creating a table: CREATETABLEexample_table(idINT

See all articles