Home php教程 php手册 apache+php+mysql+phpmyadmin 配置

apache+php+mysql+phpmyadmin 配置

Jun 06, 2016 pm 07:58 PM
Configuration

一 先给出各个包的下载地址 APACHE 下载地址 PHP 下载地址 phpMyadmin 下载地址 MYSQL 下载地址1 下载地址2 如果不想安装配置网上也有很多正在更新的集成包 xampp 下载地址 appserv 下载地址 wamp 下载地址 二 安装 1. 安装apache 图文参考 http://hi.baidu.

一     先给出各个包的下载地址

APACHE           下载地址

PHP                   下载地址

phpMyadmin     下载地址

MYSQL              下载地址1      下载地址2


如果不想安装配置网上也有很多正在更新的集成包

xampp       下载地址

appserv      下载地址

wamp        下载地址

二   安装

   1. 安装apache        图文参考      http://hi.baidu.com/chchyuexia/item/0f10521db1c660f565eabff8

  @1

  apache+php+mysql+phpmyadmin 配置

  

   Network Domain:填写你的域名。  本地设置 localhost

  Server Name:填写你的服务器名称,也就是完整的主机名加上域名。 本地设置   localhost

  Administrator's Email Address:填写管理员的email地址。  例如  localhost@admin.com

 or All Users, on Port 80,as a Service -- Recommended.
    为系统所有用户安装,使用默认的80端口,并作为系统服务自动启动。
    only for the Current User, on Port 8080, when started Manually.
    仅为当前用户安装,使用端口8080,手动启动。
 (我已经安装过IIS了,IIS已经使用了80端口,所以在这里我选择第二项,设置apache使用8080端口。)


 @2   继续下一步

   apache+php+mysql+phpmyadmin 配置

   Typical为默认典型安装,Custom为用户自定义安装。我这里选择Typical。按“Next”继续。

   @3     接下来设置安装的路径

   apache+php+mysql+phpmyadmin 配置

    

不直接装在C盘,以防重新系统后要重新配置,这里也可根据自己的喜好设置安装路径。比如我安装在G:/apache/
        注意:目录名不要包含空格,否则下面设置php会出错。

      安装完后小图标是红色的不要紧张,安装完下面这一步非常重要,要不然就是一个小红图标。

    @4、安装结束后,需要手动启动apache。   在桌面上右击“我的电脑-->管理-》打开服务和应用程序-服务”  在右侧找到apache 点击启动

   测试是否安装成功   在地址栏输入 http://localhost/    会出现 it  works 表示安装成功

   @5  配置apache  在apache的安装目录里找到conf / httpd.conf   打开编辑   

       大约182左右    配置apache的网站目录  DocumentRoot "G:/apache/htdocs"


   2 . 安装配置 php    (注意的是:如果下载的php目录里木有.dll 文件 是下载的安装包不对         参考文件  如果在官网上下载 windows下要下载vc6-x86的

   在G盘新建一个php目录  把下载的php压缩包解压进去,

在解压的根目录下找到php.ini-development,是用于开发环境的配置文件;还有一个php.ini-production,这个是用于生产环境的配置文件。使用php.in-development,复制一份,重命名为php.ini。开始编辑。   文件参考

 3. 在apache里配置php

 大约在244行左右 


    DirectoryIndex  index.php index.html

大约127行左右   

(1)、130行(是一堆LoadModule **.so的末尾行),增加一行:

        LoadModule php5_module  "g:/php/php5apache2_2.dll"

          PHPIniDir   "g:/php"

(2)、搜索AddType,并在最后这个字段的下一行空白处添加如下信息:

      AddType application/x-httpd-php .php              大约417行

(3)、保存并关闭httpd.conf。


4.  配置phpmyadmin   

在G 盘里 新建一个phpmyadmin目录    把文件解压进去    把libraries下的config.default.php 复制到外面重命名为config.inc.php 

在大约 223左右  $cfg['Servers'][$i]['user'] = 'root';      配置一下 用户名和密码

在apache 里 配置一下phpmyadmin    在apache安装目录里找到conf/httpd.conf 打开编辑 在大约316行左右(搜索 filesystem/path) 添加下面这句代码

 Alias /phpmyadmin "G:/phpmyadmin"

AllowOverride None
Options None
Order allow,deny
Allow from all

  图示  

apache+php+mysql+phpmyadmin 配置

   

5. mysql的安装配置

apache+php+mysql+phpmyadmin 配置


如图:有“Typical(默认)”、“Complete(完全)”、“Custom(用户自定义)”三个选项,我们选择“Custom”,有更多的选项,也方便熟悉安装过程。按“Next”继续。出现下面窗口:

apache+php+mysql+phpmyadmin 配置


  点选“Change...”,手动指定安装目录。填上安装目录,我的是“G:\mysql”

之后按“Install”开始安装。

    开始安装中,请稍候,直到出现下面的界面:

apache+php+mysql+phpmyadmin 配置


这里是询问你是否要注册一个mysql.com的账号,或是使用已有的账号登陆mysql.com,一般不需要了,点选“Skip Sign-Up”,按“Next”略过此步骤,继续安装。


apache+php+mysql+phpmyadmin 配置


    

点“Finish”结束软件的安装并启动进入mysql配置向导。

    mysql配置向导启动界面,按“Next”继续出现这个界面:


 apache+php+mysql+phpmyadmin 配置

在这里要求你选择配置方式,“Detailed Configuration(手动精确配置)”、“Standard Configuration(标准配置)”,我们选择第一项“Detailed Configuration”,进行详细设置,方便熟悉配置过程。好了,再按“Next”继续。

apache+php+mysql+phpmyadmin 配置


  在这个界面,要求你 选择服务器类型,“Developer Machine(开发测试类,mysql占用很少资源)”、“Server Machine(服务器类型,mysql占用较多资源)”、“Dedicated MySQL Server Machine(专门的数据库服务器,mysql占用所有可用资源)”,大家根据自己的类型选择了。一般选“Server Machine”,不会太少,也不会占满。我选了第二项,Server Machine(服务器类型,mysql占用较多资源)。


apache+php+mysql+phpmyadmin 配置


上面这个界面,要求你选择mysql数据库的大致用途::

    第一项:“Multifunctional Database(通用多功能型,好)”、

    第二项:“Transactional Database Only(服务器类型,专注于事务处理,一般)”、

    第三项:“Non-Transactional Database Only(非事务处理型,较简单,主要做一些监控、记数用,对MyISAM数据类型的支持仅限于non-transactional),

    这里随自己的用途而选择了,我这里选择“Transactional Database Only”,按“Next”继

续。


apache+php+mysql+phpmyadmin 配置

不用配置   继续next

apache+php+mysql+phpmyadmin 配置

这里要求选择您的网站的一般mysql访问量,同时连接的数目,“Decision Support(DSS)/OLAP(20个左右)”、“Online Transaction Processing(OLTP)(500个左右)”、“Manual Setting(手动设置,自己输一个数)”,我这里选“Online Transaction Processing(OLTP)”,自己的服务器,应该够用了,按“Next”继续。

apache+php+mysql+phpmyadmin 配置

这个界面,是问你是否启用TCP/IP连接,设定端口。如果不启用,就只能在自己的机器上访问mysql数据库了,我这里启用,把前面的勾打上,Port Number:3306,按“Next”继续。


apache+php+mysql+phpmyadmin 配置


   这个界面的选项比较重要,就是对mysql默认数据库语言编码进行设置。

    第一个是西文编码,

    第二个是多字节的通用utf8编码。

   前二个都不是我们通用的编码,这里选择第三个,然后在Character Set那里选择或者填入“gbk”。当然也可以用“gb2312”,二者的区别就是gbk的字库容量大,包括了gb2312的所有汉字,并且加上了繁体字、和其它乱七八糟的字——使用mysql的时候,在执行数据操作命令之前运行一次“SET NAMES GBK;”(运行一次就行了,GBK可以替换为其它值,视这里的设置而定),就可以正常的使用汉字(或其它文字)了,否则不能正常显示汉字。按 “Next”继续。

apache+php+mysql+phpmyadmin 配置


 这一步是询问你选择是否将mysql安装为windows服务,还可以指定Service Name(服务标识名称),是否将mysql的bin目录加入到Windows PATH(加入后,就可以直接使用bin下的文件,而不用指出目录名,比如连接,“mysql.exe -uusername -ppassword;”就可以了,不用指出mysql.exe的完整地址,很方便)。

    我这里全部打上了勾,Service Name不变。按“Next”继续。


apache+php+mysql+phpmyadmin 配置


这里设置密码要和phpmyadmin里配置的用户名和密码要相同

这一步询问是否要修改默认root用户(超级管理)的密码(默认为空),“New root password”如果要修改,就在此填入新密码(如果是重装,并且之前已经设置了密码,在这里更改密码可能会出错,请留空,并将“Modify Security Settings”前面的勾去掉,安装配置完成后另行修改密码),“Confirm(再输一遍)”内再填一次,防止输错。“Enable root access from remote machines(是否允许root用户在其它的机器上登陆,如果要安全,就不要勾上,如果要方便,就勾上它)”。最后“Create An Anonymous Account(新建一个匿名用户,匿名用户可以连接数据库,不能操作数据,包括查询)”,一般就不用勾了,设置完毕,按“Next”继续。

    之后出现下面的界面,这里是要你确认设置无误,如果有误,按“Back”返回检查。如果正确,按“Execute”使设置生效。


apache+php+mysql+phpmyadmin 配置


 按下“Execute”后,请耐心等一下

        这时设置完毕,可以按“Finish”结束mysql的安装与配置

这里可能出现的错误是 start service  启动失败,这个极有可能的原因是机子上先前安装过mysql 没有清理干净  找到安装mysql的目录 删除里面的data目录即可

http://localhost/phpmyadmin  登陆测试一下



最后在提醒大家注意一下 : mysql 和phpmyadmin的版本不搭配也会出现错误。mysql5.5的版本 可以 搭配最新的几个phpmyadmin的版本



整体测试



<?php $link = mysql_connect('localhost','root','123456');
mysql_select_db('test',$link);
mysql_query('set names utf8');
$sql = "select * from user";
$result = mysql_query($sql);
$rows=mysql_fetch_assoc($result);
print_r($rows);

echo phpinfo();
?>
Copy after login





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)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1268
29
C# Tutorial
1243
24
How to set up Git configuration in PyCharm How to set up Git configuration in PyCharm Feb 20, 2024 am 09:47 AM

Title: How to correctly configure Git in PyCharm In modern software development, the version control system is a very important tool, and Git, as one of the popular version control systems, provides developers with powerful functions and flexible operations. As a powerful Python integrated development environment, PyCharm comes with support for Git, allowing developers to manage code versions more conveniently. This article will introduce how to correctly configure Git in PyCharm to facilitate better development during the development process.

The working principle and configuration method of GDM in Linux system The working principle and configuration method of GDM in Linux system Mar 01, 2024 pm 06:36 PM

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

The perfect combination of PyCharm and PyTorch: detailed installation and configuration steps The perfect combination of PyCharm and PyTorch: detailed installation and configuration steps Feb 21, 2024 pm 12:00 PM

PyCharm is a powerful integrated development environment (IDE), and PyTorch is a popular open source framework in the field of deep learning. In the field of machine learning and deep learning, using PyCharm and PyTorch for development can greatly improve development efficiency and code quality. This article will introduce in detail how to install and configure PyTorch in PyCharm, and attach specific code examples to help readers better utilize the powerful functions of these two. Step 1: Install PyCharm and Python

Understand Linux Bashrc: functions, configuration and usage Understand Linux Bashrc: functions, configuration and usage Mar 20, 2024 pm 03:30 PM

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

How to configure workgroup in win11 system How to configure workgroup in win11 system Feb 22, 2024 pm 09:50 PM

How to configure a workgroup in Win11 A workgroup is a way to connect multiple computers in a local area network, which allows files, printers, and other resources to be shared between computers. In Win11 system, configuring a workgroup is very simple, just follow the steps below. Step 1: Open the "Settings" application. First, click the "Start" button of the Win11 system, and then select the "Settings" application in the pop-up menu. You can also use the shortcut "Win+I" to open "Settings". Step 2: Select "System" In the Settings app, you will see multiple options. Please click the "System" option to enter the system settings page. Step 3: Select "About" In the "System" settings page, you will see multiple sub-options. Please click

Simple and easy-to-understand PyCharm configuration Git tutorial Simple and easy-to-understand PyCharm configuration Git tutorial Feb 20, 2024 am 08:28 AM

PyCharm is a commonly used integrated development environment (IDE). In daily development, using Git to manage code is essential. This article will introduce how to configure Git in PyCharm and use Git for code management, with specific code examples. Step 1: Install Git First, make sure Git is installed on your computer. If it is not installed, you can go to [Git official website](https://git-scm.com/) to download and install the latest version of Git

How to configure and install FTPS in Linux system How to configure and install FTPS in Linux system Mar 20, 2024 pm 02:03 PM

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

Avoid common mistakes in Maven environment configuration: Solve configuration problems Avoid common mistakes in Maven environment configuration: Solve configuration problems Feb 19, 2024 pm 04:56 PM

Maven is a Java project management and build tool that is widely used in the development of Java projects. In the process of using Maven to build projects, you often encounter some common environment configuration problems. This article will answer these common questions and provide specific code examples to help readers avoid common configuration errors. 1. Maven environment variables are incorrectly configured. Problem description: When using Maven, if the environment variables are incorrectly configured, Maven may not work properly. Solution: Make sure

See all articles