The first step: Download the required software, PHP, Apache, MySQL, PHPmyadmin
Note: 1. The number of software bits needs to be the same, more than the number of their own computer, for example, the computer is 64-bit, you need to download 64-bit software
2. Note the Apache and PHP cooperation, PHP version 5.5 or more to support Apache2.4 server, if the version does not correspond, the Apache server will not start, can not load PHP module situation
Demo in 64-bit version of my computer:
Download URL:
php:http://windows.php.net/download#php-7.0
Apache:https://www.apachehaus.com/cgi-bin/download.plx
Mysql:http://dev.mysql.com/downloads/mysql/5.7.html
phpmyadmin:https://www.phpmyadmin.net/downloads/
Step two: Start installing Apache
How to install there are several versions, some are directly compressed package decompression, and then use the command line operation, this method compared to the good point, there is a direct download MSI version, a fool installation, here is the first method of introduction:
1. Unzip the compressed package, note the path
2. Because of the need for VC compilation, in order to avoid installation errors, you can install the VC runtime, preferably 64-bit and 32-bit are installed to avoid installation errors
3. Locate the profile httpd.conf, open with Notepad, find:Define srvroot Modify the path for your Apache decompression
4. Open the cmd window (win+r), enter:"E:\ampServer\Apache24\bin\httpd.exe"-K install-n apache24 Copy the quotation marks. Then enter to show that the installation was successful, that is, the primary service was installed successfully. (Administrator privileges are required here, note the file path)
5. Open the browser to access the 127.0.0.1, if the Apache welcome interface is displayed, the installation is successful, if not displayed, is generally a few reasons:
A. Port is occupied, can modify the listening port to the configuration file httpd.conf, change to 8080, or other
B. There is a configuration file inside the Deny form all, you need to change the deny to allow, detailed can refer to: http://www.jb51.net/os/RedHat/1303.html
The third step: Download PHP, unzip, download must pay attention to the version of the problem, I was in the version spent a lot of time, re-installed several times,
1. Locate the php.ini-development file in the main PHP directory, rename it to php.ini, open it with Notepad, find Extension_dir = "ext", ext That is, the main directory of PHP extension folder, in front of ext plus ext folder path, note to remove the previous score number, semicolon is the role of annotations
2. Locate the Apache configuration file httpd.conf, and add the following code to the long list of commented out extensions:
#***********php integration with Apache *****************************
#让apache载入php处理模块
LoadModule Php7_module E:/ampserver/php-7.0.10/php7apache2_4.dll
#指定php的ini文件, this file is some configuration of PHP
Phpinidir "e:/ampserver/php-7.0.10"
AddType application/x-httpd-php. php. phtml
#*******************************************************
3.Apache Server default target directory is Apache/htdocs, can be modified in the Conf file, DocumentRoot, the file directory into a custom file, and then in the Titrator file under the new PHP file, add the following code to the PHP file:
<?php
Phpinfo ();
?>
Then open the file in the browser, if you can display the PHP integration diagram to show that the integration is successful
Fourth step: MySQL download installation and integration with PHP
To download MySQL, please log in directly to http://dev.mysql.com/downloads/mysql/5.7.html and download 32-bit or 64-bit based on the number of operating system bits
It is recommended to download an MSI version of the installation to be more convenient, the web also has a detailed tutorial, because the software installed after a lot of problems need to solve
1. Carefully refer to the online installation tutorial: http://www.cnblogs.com/seaBiscuit0922/p/5573043.html
2. Configure the environment variables (Baidu itself here)
3. Open the php.ini file and locate extension = Php_mysql.dll,extension = Php_mysqli.dll Remove the preceding comment semicolon;
4. Write a PHP code (testmysql.php) for testing, save the Htdocs folder in the Apache directory
<?php
$coun =mysqli_connect ("localhost", "root", "root", "MySQL");
if ($coun) {
echo "Connected successfully";
}else{
echo "Connection Failed";
}
?>
Restart Apache, in the browser input 127.0.0.1:8080/testmysql.php (8080 for my port), if the connection can be displayed successfully, then the PHP and MySQL integration successfully
Fifth step: phpMyAdmin's Download configuration
1. Download:https://www.phpmyadmin.net/downloads/
2. Unzip to the target folder previously configured, named phpMyAdmin
3. Under the phpMyAdmin folder, locate libraries/config_default.php, open the php file, open the configuration $cfg [' Servers '] [$i] [' password '] = ' new password '; Then set the phrase password $cfg [' blowfish_secret '] = '; If you don't know what the phrase password wants to set, you can set it later.
4. In the browser access http://localhost:8080/phpMyAdmin/index.php Enter the login page enter the user name: root password: The new password (database password) to log in.
To summarize:
1. When configuring the Apache server, the port is prone to be occupied,
Detection of 80 port occupancy: Start-run-input cmd (carriage return)-Open a command prompt to enter--netstat-ano, you can view the local port opening and corresponding program
。 Such as:
It can be seen that the 80 port is occupied by the pid1720 process, now, as long as the PID 1720 process can release the 80 port. Open Task Manager
The default task manager does not have PID, just check the PID in the View-option column (s).
Figure, you can see that the pid:1720 corresponding process is inetinfo.exe. (Explain the Inetinfo.exe process later) if you just end the process now, anyway inetinfo.exe will automatically rerun, but this time the PID will change. So this does not completely release the 80 port.
Last action: Stop IIS "Default Web site. In fact, the culprit is IIS, because I have to do the site before, need to install IIS, and create a site, in the Control Panel-management tool-internet Information Services-the site can see this site, just to stop this site can be, Then you go to start-run-enter cmd (carriage return)-open command Prompt--netstat-ano, you can see there is no 80 port, this time when the software is installed, everything went well.
Note: The process PID can be changed, that is, the same program running at different times, its PID number is different. The PID number of the same process is different in many different computers. Therefore, the PID before the end of Inetinfo.exe is a three-digit number, and after restarting it may have a PID of four digits. This does not affect the solution of the problem, I am just curious, then come up and say it.
2. You can also use the command line to detect where the problem is.
Run as administrator in my case f:/service/apache/bin/httpd.exe-w-n "apache2.2"-K Start
If something goes wrong, show it first so you know exactly where it went wrong.
3. Then note that because the default port for 127.0.0.1 and localhost is 80, that is, 127.0.0.1:80 and the first two are the same, but if you modify the port, you need to add the ports, such as my 127.0.0.1:8080
In fact, if you want to input 127.0.0.1 every time too much trouble can also go to modify Apache configuration files and Hosts file, in particular, can refer to:
Http://www.cnblogs.com/hi-bazinga/archive/2012/04/23/2466605.html
4. Then 403 does not have the permission question, here can refer to: http://www.jb51.net/os/RedHat/1303.html
Finish!
Reminder: Configure this server test environment, need to first understand PHP Apache MySQL version of the corresponding relationship, as well as the need to pay attention to the software and computer system number of matches, problems do not give up easily, learn to use search engines, understand that these will be more effective!
Php+apache+mysql+phpmyadmin installation, configuration, integration