Home Database Mysql Tutorial csdn apache+php+mysql在windows下的安装和配置_MySQL

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

Jun 01, 2016 pm 01:32 PM
mysql windows

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 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 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)

Centos install mysql Centos install mysql Apr 14, 2025 pm 08:09 PM

Installing MySQL on CentOS involves the following steps: Adding the appropriate MySQL yum source. Execute the yum install mysql-server command to install the MySQL server. Use the mysql_secure_installation command to make security settings, such as setting the root user password. Customize the MySQL configuration file as needed. Tune MySQL parameters and optimize databases for performance.

How to install mysql in centos7 How to install mysql in centos7 Apr 14, 2025 pm 08:30 PM

The key to installing MySQL elegantly is to add the official MySQL repository. The specific steps are as follows: Download the MySQL official GPG key to prevent phishing attacks. Add MySQL repository file: rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm Update yum repository cache: yum update installation MySQL: yum install mysql-server startup MySQL service: systemctl start mysqld set up booting

Can vs code run in Windows 8 Can vs code run in Windows 8 Apr 15, 2025 pm 07:24 PM

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

How to start mysql by docker How to start mysql by docker Apr 15, 2025 pm 12:09 PM

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

MySQL vs. Oracle: The Pros and Cons MySQL vs. Oracle: The Pros and Cons Apr 14, 2025 am 12:01 AM

MySQL and Oracle selection should be based on cost, performance, complexity and functional requirements: 1. MySQL is suitable for projects with limited budgets, is simple to install, and is suitable for small to medium-sized applications. 2. Oracle is suitable for large enterprises and performs excellently in handling large-scale data and high concurrent requests, but is costly and complex in configuration.

MySQL vs. Other Databases: Comparing the Options MySQL vs. Other Databases: Comparing the Options Apr 15, 2025 am 12:08 AM

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

What is vscode What is vscode for? What is vscode What is vscode for? Apr 15, 2025 pm 06:45 PM

VS Code is the full name Visual Studio Code, which is a free and open source cross-platform code editor and development environment developed by Microsoft. It supports a wide range of programming languages ​​and provides syntax highlighting, code automatic completion, code snippets and smart prompts to improve development efficiency. Through a rich extension ecosystem, users can add extensions to specific needs and languages, such as debuggers, code formatting tools, and Git integrations. VS Code also includes an intuitive debugger that helps quickly find and resolve bugs in your code.

How to choose a GitLab database in CentOS How to choose a GitLab database in CentOS Apr 14, 2025 pm 05:39 PM

When installing and configuring GitLab on a CentOS system, the choice of database is crucial. GitLab is compatible with multiple databases, but PostgreSQL and MySQL (or MariaDB) are most commonly used. This article analyzes database selection factors and provides detailed installation and configuration steps. Database Selection Guide When choosing a database, you need to consider the following factors: PostgreSQL: GitLab's default database is powerful, has high scalability, supports complex queries and transaction processing, and is suitable for large application scenarios. MySQL/MariaDB: a popular relational database widely used in Web applications, with stable and reliable performance. MongoDB:NoSQL database, specializes in

See all articles