search
HomeDatabaseMysql Tutorialcsdn apache+php+mysql在windows下的安装和配置_MySQL

Apache

bitsCN.com

csdn apache+php+mysql在windows下的安装和配置

 

开始搭建环境:

 

安装的版本:apache2.2.22、mysql 5.5.24、php 5.3.13

 

(1)      在安装的时候,一定要把以前安装的apache等卸载,在卸载之前一定的注意,停止apache,mysql的服务,在停止服务后,我们在分别卸载apache,mysql。

 

(2)      安装apache,没有特殊的东西,一直默认就好,更改个路径就可以

 

csdn apache+php+mysql在windows下的安装和配置_MySQL

 

(3)      

 

(4)      网络域名,随便写就可以,例如setnet.com,服务器域名:写localhost,邮箱随便写

 

就这个需要注意其他不用改,测试apache是否安装成功,打开浏览器在地址栏输入localhost,如果出现it works!表示安装成功。Apache就这样安装完毕。

 

(5)     安装php

 

(6)      因为php是作为apache的一个模块存在的,所以通过apache的配置文件将php加载过来。

 

   以上是apache,php,mysql安装到的文件夹,把你们php安装的压缩包解压,把解压出来的文件夹下面的文件全部复制到以上php文件夹下。

 

然后在apache的文件夹下的conf下的httpd.conf文件,加载模块

 

Php5apache2_2.dll的路径是当前php文件夹下的路径,d:/myevn/php/是我安装的路径

 

(7)      写一个php文件,测试php文件能正常输出吗,有的输出来的是文件的所有代码,如果出现这种问题,我们可以在加载php模块的下面

 

这样再试试php文件一般就没有什么问题了。

 

(8)     安装mysql

 

(9)      安装的时候也是一直默认,遇到coudom的时候,选择这个,然后遇见要改路径的时候,记得修改安装的路径,

 

csdn apache+php+mysql在windows下的安装和配置_MySQL

 

千万记得要修改编码的时候选择utf8,一直走默认,密码例如:

 

csdn apache+php+mysql在windows下的安装和配置_MySQL

 

密码写不写都不可以,如果写了在用数据库的必须提前输入密码才能打开数据库,

 

,不写访问数据库直接访问就可以。

 

还有安装的时候,会出现一个列表,跟树状差不多,由于我安装了不方便截图,记得选择mysql修改它的路径,他的路径例如D:/mysvn/mysql/data/data,就是你mysql安装到的文件下的dada里面的dada里面。测试就在php文件下下,mysql_connect(‘localhost’,’root’,’’);后面的引号,是密码,要写密码,没有密码空着就ok了。成功了会出现resource(3) of type (mysql link)类似这些歇息。

 

(10)  到达这一地步,咱们就全部安装成功。

 

(11) 虚拟目录的配置

 

(1)浏览器的配置:在系统盘,我的系统盘是c盘,c盘下的C:/Windows/System32/drivers/etc的hosts文件,我们需要修改,利用域名解析的原理,在hosts文件里最后写上

 

127.0.0.1       localhost

 

127.0.0.1       www.php.com

 

127.0.0.1       www.sina.com

 

这是指定域名的ip地址,www.sina.com这就是虚拟目录

 

(2)每一个网站可以作为一个模块,分而治之,

 

修改apache的配置文件

 

httpd.conf

 

定位到

 

# Virtual hosts

 

#Include conf/extra/httpd-vhosts.conf

 

去掉注释

 

然后找到conf/extra/httpd-vhosts.conf文件每一个网站对应一个模块

 

(3)例如www.sina.com、或者localhost等都对应apache的配置文件httpd.conf,修改httpd.conf定位到

 

 

            ServerAdmin webmaster@dummy-host2.somenet.com

 

            DocumentRoot "D:/myenv/apache/docs/dummy-host2.somenet.com"

 

            ServerName dummy-host2.somenet.com

 

           ErrorLog"logs/dummy-host2.somenet.com-error.log"

 

           CustomLog"logs/dummy-host2.somenet.com-access.log" common

 

 

自己配置一个,一个模块至少有两项,1,我的域名是谁2,我的网站的根目录在哪里?

 

 

           DocumentRoot "D:/myenv/myweb/sina"

 

           ServerName  www.sina.com

 

 

访问之后显示forbbiden权限,修改权限:

 

 

                Order Deny,Allow

 

Deny from All

 

                Allow from All

 

           

 

有两种写法:

 

(1)

 

          DocumentRoot "D:/mysvn/myweb/sina"

 

          ServerName www.sina.com

 

         

 

          Options Indexes MultiViews

 

         order allow,deny

 

         Allow from all

 

         

 

 

 

 

(2)

 

         DocumentRoot"D:/mysvn/apache/htdocs"

 

         ServerName localhost

 

       

 

             Order Deny,Allow

 

       Deny from All

 

             Allow from All

 

       

 

 

(12)  配置php.ini文件,让他可以操作mysql

 

默认情况下,没有php.ini配置文件,但是提供

 

Php.ini-development 开发模式

 

Php.ini-production   生产环境

 

修改php.ini之后,因为apache会读取pp的配置文件,需要告诉apache php配置文件位置

 

首先:修改php.ini

 

extension=php_mysql.dll取消前面的注释。

 

然后:修改apache的conf下的httpd.conf

 

LoadModulephp5_module "D:/mysvn/php/php5apache2_2.dll"

 

 

 

 

SetHandlerapplication/x-httpd-php

 

 

 

 

PHPIniDir D:/mysvn/php这是新增加的

 

到目前为止,三大巨头安装告以段落。

 

 

bitsCN.com
Statement
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
Explain the InnoDB Buffer Pool and its importance for performance.Explain the InnoDB Buffer Pool and its importance for performance.Apr 19, 2025 am 12:24 AM

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL vs. Other Programming Languages: A ComparisonMySQL vs. Other Programming Languages: A ComparisonApr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Learning MySQL: A Step-by-Step Guide for New UsersLearning MySQL: A Step-by-Step Guide for New UsersApr 19, 2025 am 12:19 AM

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL: Essential Skills for Beginners to MasterMySQL: Essential Skills for Beginners to MasterApr 18, 2025 am 12:24 AM

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL: Structured Data and Relational DatabasesMySQL: Structured Data and Relational DatabasesApr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL: Key Features and Capabilities ExplainedMySQL: Key Features and Capabilities ExplainedApr 18, 2025 am 12:17 AM

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

The Purpose of SQL: Interacting with MySQL DatabasesThe Purpose of SQL: Interacting with MySQL DatabasesApr 18, 2025 am 12:12 AM

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

MySQL for Beginners: Getting Started with Database ManagementMySQL for Beginners: Getting Started with Database ManagementApr 18, 2025 am 12:10 AM

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

See all articles

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 Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool